Commit Graph
3334 Commits
Author SHA1 Message Date
Daniel Gasienica f9d4cfb2ba Simplify operator-linebreak configuration
Enabling `before` caused more code changes and it turns out our previous
configuration is already the default.
2018-02-15 17:18:30 -05:00
Daniel Gasienica db588997ac Remove obsolete TODO 2018-02-15 17:15:59 -05:00
Daniel Gasienica 799c881763 Enable ESLint function-paren-newline multiline
Per discussion.
2018-02-15 17:12:30 -05:00
Daniel Gasienica b660b6bc8e Use messageDescriptor.id not source 2018-02-15 17:10:48 -05:00
Daniel Gasienica 5e7309d176 Remove unnecessary eslint-env 2018-02-15 15:16:58 -05:00
Daniel Gasienica 393b3da55e Refactor onSentMessage and onMessageReceived
Since they are so similar, we create the handlers using new
`createMessageHandler` function. This allows us to ensure both synced and
received messages go through schema upgrade pipeline.
2018-02-15 15:16:58 -05:00
Daniel Gasienica b3db0bf179 Add Message descriptor functions 2018-02-15 15:16:58 -05:00
Daniel Gasienica 8febf125b1 Fix typo 2018-02-15 15:16:58 -05:00
Daniel Gasienica 98d951ef77 Remove promises reference 2018-02-15 15:16:58 -05:00
Daniel Gasienica a0e9559ed5 Fix AttachmentView::mediaType fall-through 2018-02-15 15:16:58 -05:00
Daniel Gasienica 67be916a83 Remove minor TODOs 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 28a2dc5b8a Remove dynamic type checks 2018-02-15 15:16:58 -05:00
Daniel Gasienica f4ce36fcfc Rename process to upgradeSchema
- `Message.process` -> `Message.upgradeSchema`
- `Attachment.process` -> `Attachment.upgradeSchema`
- `Attachment::processVersion` -> `Attachment::schemaVersion`

Document version history.
2018-02-15 15:16:58 -05:00
Daniel Gasienica 41b92c0a31 Add operator-linebreak ESLint rule
Based on the following discussion:
https://github.com/signalapp/Signal-Desktop/pull/2040#discussion_r168029106
2018-02-15 15:16:58 -05:00
Daniel Gasienica 462defbe55 Add missing await for ConversationController.getOrCreateAndWait
Tested this by setting `if` condition to `true` and confirming it works.
It turns rotating a profile key is more involved and might require registering a
new account according to Matthew.
2018-02-15 15:16:58 -05:00
Daniel Gasienica c08058ee4b Convert FileList to Array 2018-02-15 15:16:58 -05:00
Daniel Gasienica 70a6c42019 🎨 Fix lint errors 2018-02-15 15:16:58 -05:00
Daniel Gasienica 2ca7cdbc31 Skip autoOrientImage for non-JPEG images 2018-02-15 15:16:58 -05:00
Daniel Gasienica 58eac38301 Move new-style modules to window.Signal namespace 2018-02-15 15:16:58 -05:00
Daniel Gasienica 02c9328877 Extract npm run test-modules command 2018-02-15 15:16:58 -05:00
Daniel Gasienica 2c708eb94f Extract Message.process 2018-02-15 15:16:58 -05:00
Daniel Gasienica 4a2e52f68a Fix EditorConfig 2018-02-15 15:16:58 -05:00
Daniel Gasienica a346bab5db Remove vim directives on ESLint-ed files 2018-02-15 15:16:58 -05:00
Daniel Gasienica 7ec885c635 Remove CSP whitelisting of blob:
We no longer use `autoOrientImage` using blob URLs. Bring this back if we
decide to auto-orient legacy attachments.
2018-02-15 15:16:58 -05:00
Daniel Gasienica 879b6f58f4 Use Message type to determine send function
Throws on invalid message type.
2018-02-15 15:16:58 -05:00
Daniel Gasienica 5203d945c9 Whitelist Whisper global 2018-02-15 15:16:58 -05:00
Daniel Gasienica 8ad0b066a3 Add Whisper.Types namespace
This avoids namespace collision for `Whisper.Message`.
2018-02-15 15:16:58 -05:00
Daniel Gasienica 785a949fce Add Message type 2018-02-15 15:16:58 -05:00
Daniel Gasienica 674a7357ab Run ESLint on Conversation::sendMessage 2018-02-15 15:16:58 -05:00
Daniel Gasienica cd985aa700 Document type signature of FileInputView::readFile 2018-02-15 15:16:58 -05:00
Daniel Gasienica d70d70e52c Move attachment processing closer to sending
This helps ensure processing happens uniformly, regardless of which code paths
are taken to send an attachment.
2018-02-15 15:16:58 -05:00
Daniel Gasienica 532ac3e273 Process attachment before it’s sent
Picked this place since it already had various async steps, similar to
`onMessageReceived` for the incoming `Attachment.process`.

Could we try have this live closer to where we store it in IndexedDB, e.g.
`Conversation::sendMessage`?
2018-02-15 15:16:58 -05:00
Daniel Gasienica a4582ae2fb Refactor getFile and getFiles
Lint them using ESLint.
2018-02-15 15:16:58 -05:00
Daniel Gasienica 07e9114e65 Document incoming and outgoing attachments fields
Note how outgoing message attachments only have 4 fields. This presumably means
the others are not used in our code and could be discarded for simplicity.
2018-02-15 15:16:58 -05:00
Daniel Gasienica fdc3ef289d Highlight that dataURLToBlob is synchronous 2018-02-15 15:16:58 -05:00
Daniel Gasienica b9c6bf600f Add EditorConfig configuration 2018-02-15 15:16:58 -05:00
Daniel Gasienica e56101e229 Replace custom with blob-util functions
IMPORTANT: All of them are async so we need to use `await`, otherwise we get
strange or silent errors.
2018-02-15 15:16:58 -05:00
Daniel Gasienica f95150f6a9 Revert "Replace custom functions with blob-util"
This reverts commit 8a81e9c01bfe80c0e1bf76737092206c06949512.
2018-02-15 15:16:58 -05:00
Daniel Gasienica 33860d93f3 Revert "Replace blueimp-canvas-to-blob with blob-util"
This reverts commit 31b3e853e4afc78fe80995921aa4152d9f6e4783.
2018-02-15 15:16:58 -05:00
Daniel Gasienica 7a0ba6fed6 Replace blueimp-canvas-to-blob with blob-util 2018-02-15 15:16:58 -05:00
Daniel Gasienica 47a5f2bfd8 Replace custom functions with blob-util 2018-02-15 15:16:58 -05:00
Daniel Gasienica 1cfa0efdb4 Add blob-util dependency 2018-02-15 15:16:58 -05:00
Daniel Gasienica 9ac26be1bd Document why we drop original image data during auto-orient 2018-02-15 15:16:58 -05:00
Daniel Gasienica 4136d6c382 Extract DEFAULT_JPEG_QUALITY 2018-02-15 15:16:58 -05:00
Daniel Gasienica 4a7156327e Drop support for invalid image/jpg MIME type 2018-02-15 15:15:00 -05:00
Daniel Gasienica 69fe96581f Document window.onInvalidStateError global 2018-02-15 15:15:00 -05:00
Daniel Gasienica a48ba1c774 Selectively run ESLint on js/background.js
Enabling ESLint on a per function basis allows us to incrementally improve the codebase
without requiring large and potentially risky refactorings.
2018-02-15 15:15:00 -05:00
Daniel Gasienica e6d1cf826b Move async attachment processing to onMessageReceived
We previously processed attachments in `handleDataMessage` which is mostly a synchronous
function, except for the saving of the model. Moving the processing into the already async
`onMessageReceived` improves code clarity.
2018-02-15 15:15:00 -05:00
Daniel Gasienica be6ca2a9aa Document import of ES2015+ modules 2018-02-15 15:15:00 -05:00