Commit Graph

54 Commits

Author SHA1 Message Date
Daniel Gasienica
a0e9559ed5 Fix AttachmentView::mediaType fall-through 2018-02-15 15:16:58 -05:00
Daniel Gasienica
0af186e118 Enable ESLint for js/views/attachment_view.js 2018-02-15 15:16:58 -05:00
Daniel Gasienica
e7da41591f Use blobUrl for consistency 2018-02-15 15:14:59 -05:00
Daniel Gasienica
523a80eefe Remove just-in-time image auto-orient for lightbox
We can bring this back if our users would like auto-orient for old attachments.
2018-02-15 15:14:59 -05:00
Daniel Gasienica
0739feae9c Remove just-in-time auto-orient of message attachments
We can bring this back if our users would like auto-orient for old attachments. But better
yet, we might implement this as database migration.
2018-02-15 15:14:59 -05:00
Daniel Gasienica
9638fbc987 Use contentType from model 2018-02-15 15:14:59 -05:00
Daniel Gasienica
4822f49f22 Auto-orient images in lightbox view 2018-02-15 15:14:59 -05:00
Daniel Gasienica
7317110809 Document magic number for escape key 2018-02-15 15:14:59 -05:00
Daniel Gasienica
c790d07389 Make second View argument an options object 2018-02-15 15:14:59 -05:00
Daniel Gasienica
c285bf5e33 Replace loadImage with autoOrientImage 2018-02-15 15:14:59 -05:00
Daniel Gasienica
b15c304a31 Make null check strict
Appeases JSHint. ESLint has a nice `smart` option for `eqeqeq` rule:
https://eslint.org/docs/rules/eqeqeq#smart
2018-02-15 15:14:59 -05:00
Daniel Gasienica
ea70b92d9b Use Canvas::toDataURL to preserve ImageView logic
This way, all the other code paths remain untouched in case we want to remove
the auto-orient code once Chrome supports the `image-orientation` CSS property.

See:
- #998
- https://developer.mozilla.org/en-US/docs/Web/CSS/image-orientation
2018-02-15 15:14:59 -05:00
Daniel Gasienica
62fd744f9f Use CSS to constrain auto-oriented images 2018-02-15 15:14:59 -05:00
Daniel Gasienica
f4d3392687 Replace ImageView el with auto-oriented canvas
See: #998
2018-02-15 15:14:59 -05:00
Daniel Gasienica
1602d7f610 Pass Blob to View (for ImageView)
This allows us to do JPEG auto-orientation based on EXIF metadata.
2018-02-15 15:14:59 -05:00
Daniel Gasienica
e6a414f2b2 🔪 Remove newline 2018-02-15 15:14:59 -05:00
Scott Nonnenberg
c70fb3a254 Video/audio: rely on the browser to detect content type (#1977) 2018-01-17 15:28:12 -08:00
Scott Nonnenberg
7781f8fa5b Treat tiffs like unrecognized files; Chrome doesn't render them (#1901) 2017-12-14 17:32:58 -08:00
lilia
b6e5439860 Fix saving attachments
// FREEBIE
2017-09-14 16:53:39 -07:00
lilia
49cdc98386 Fix lightbox 2017-09-14 16:53:35 -07:00
Scott Nonnenberg
65283d2794 Unload conversations and old messages every half-hour
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
12b2674bde Show size of files even if size not precomputed for attachment
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
24174312b9 Fix: Show attachment views; they trigger update syncrhonously
FREEBIE
2017-06-16 10:52:57 -07:00
Scott Nonnenberg
25ebcc3131 Fix broken reference to i18n string 'mediaMessage'
FREEBIE
2017-06-01 15:38:26 -07:00
lilia
3f1d8ee2b8 Fix display name for ios voice messages
iOS populates a filename for voice messages which was overruling our check for
the voice message flag when choosing the display name.

// FREEBIE
2017-05-19 10:25:30 -07:00
lilia
3ea5c0435b Update attachment style
Add names and sizes for all attachments except images, and (as with
arbitrary attachments), clicking on the text will open a save dialog.
In the absence of a filename, choose something that makes sense.

Display different icons for different media types, including distinct icons
for voice notes and audio files.

In iOS theme, audio, video, voice, and files are all encapsulated in bubbles.

Closes #804
Closes #842
Closes #836

// FREEBIE
2017-05-12 15:27:45 -07:00
Scott Nonnenberg
ee00ad0e15 File attachments: show file size, bold filename, make icon bigger
FREEBIE
2017-05-09 15:14:20 -07:00
lilia
bab9580c3a Don't fallback to file view for images
Also lengthen the timeout a bit.

// FREEBIE
2017-04-19 18:17:14 -07:00
lilia
c98ec91cab Fix tests again 2017-04-18 16:51:56 -07:00
lilia
a2f0d6c739 Fix tests 2017-04-18 16:39:00 -07:00
lilia
c9b4ae6e80 Save 'video/quicktime' files as .mov
Sometimes .mov files arrive with content type video/quicktime, but must
be saved to .mov in order for osx to recognize them as videos and open
the appropriate default program, display thumbnails, etc...

// FREEBIE
2017-04-18 16:27:50 -07:00
lilia
a27ea20f3e Improve unsupported file type handling
Make arbitrary files look nicer and display the filename.

If an audio or video element fails to load for any reason, timeout after
a few seconds and render it as an arbitrary file. Also short circuit to
this treatment for common audio and video file types that we know are
going to fail, e.g., proprietary formats from apple.

// FREEBIE
2017-04-18 16:27:50 -07:00
lilia
fc514aa96f Add support for attachment file names
Send, receive, and save attachment filenames. Use them as suggested
names when saving files.

// FREEBIE
2017-04-18 11:48:56 -07:00
Blake Griffith
1e498294e0 Add attachment_views_test.js tests 2017-02-06 21:23:35 -08:00
lilia
41216f1378 Add timestamps to attachment filenames 2017-01-25 20:40:24 -08:00
lilia
8a153e942e Fix lightbox
// FREEBIE
2016-06-30 16:56:51 -07:00
lilia
f670061669 Pressing escape closes the lightbox
// FREEBIE
2016-06-30 12:28:36 -07:00
lilia
a069939f65 Refactor attachment saving for DRYness
// FREEBIE
2016-06-30 12:28:36 -07:00
Benedikt Radtke
a1345c52b4 Added Save-As dialog for unsupported filetypes
Despite the "click to save"-description of unsupported file types, clicking them did not save them.
This commit implements a Save-As dialog instead of opening the file in chrome.

// FREEBIE
2016-06-30 00:18:36 -07:00
lilia
9091233950 Open images in a lightbox
Adds file-write permission for saving to disk from lightbox.

Fixes #810

// FREEBIE
2016-06-20 11:55:23 -07:00
lilia
ccdbfc3e12 i18n AttachmentView
// FREEBIE
2016-01-02 02:51:24 -08:00
lilia
881aa1685d Fix up unsupported attachment rendering
Rather than simply displaying an inactionable error, render a link that
allows the user to save the unsupported attachment.

// FREEBIE
2015-12-21 17:57:35 -08:00
David Baldwynn
8251db6ae6 Added error message for unsupported attachment type (issue #419) 2015-12-21 00:19:32 -08:00
lilia
2fc78ddd7d Fix scroll position jumping when images load
Messages with images or media were causing the scroll position to jump
around when they loaded, because rendering them changed the height of their
elements from 0 to full-height sometime after they were inserted into
the DOM.

Now when rendering attachments, we wait for them to load so they can
render at full height immediately, then warn our parent message list
before and after a potential height change, so the scroll position can
be saved and reset.

// FREEBIE
2015-11-15 15:32:35 -08:00
lilia
2e32c7bbc3 Small refactor of attachment views
Bind the sub-view to some data when we initialize it, rather than
passing it in on render. That means the image view click handler will
only ever open the blob we bound it to, even if its src attr changes for
some reason, which should never happen, but if it does, it's nice to
guard against opening arbitrary urls found in the dom.

// FREEBIE
2015-10-21 10:52:20 -07:00
Odysseas
49585c8c57 Add feature to open image attachments
Images that are attached to messages, either sent or received
can be opened in a new tab by clicking on them.

The previous approach that used Anchors to open the image
attachmets failed in various systems because:
 - Chrome on Windows recognised "blob" as protocol and tried
   to find an app for it
 - Chromium on Ubuntu didn't open a new window to load the URL

The new approach adds a "click" listener to the IMG element and
opens the link using window.open (which seems to be working globaly).

Resolves: #252
2015-10-21 10:26:14 -07:00
lilia
f764445c86 Remove erroneous license file and headers
We only use GPLV3 around here.

// FREEBIE
2015-09-07 14:58:42 -07:00
lilia
bd82591b6c Remove extraneous listener 2015-03-23 16:05:55 -07:00
lilia
258a872ce3 Trigger update events after attachments load
Mostly so we can ensure we're scrolled to the bottom when the
conversation is loaded.
2015-03-03 13:23:55 -08:00
lilia
f9ca13a86f DRY up audio and video views 2015-03-03 13:05:39 -08:00