Commit Graph

533 Commits

Author SHA1 Message Date
Daniel Gasienica 4c4443390a Rename createImporter to createAttachmentDataWriter 2018-04-04 19:11:46 -04:00
Scott Nonnenberg 1326b26585 Full styleguide now available via yarn styleguide
Due to a number of hacks, the style guide can be used to show Backbone
views. This will allow a smooth path from the old way of doing things to
the new.
2018-04-04 16:08:38 -07:00
Scott Nonnenberg f86a6ef752 Update style of i18n, pull it in via preload instead of .html 2018-04-04 16:03:10 -07:00
Daniel Gasienica bf67254cc5 Add Message.createImporter 2018-04-04 18:41:50 -04:00
Daniel Gasienica 5a6668e677 Add Attachments.createWriteForExisting
This function lets us choose where to write attachment to instead of picking
random name.
2018-04-04 18:41:50 -04:00
Daniel Gasienica efd673083d Rename writeAttachmentData to writeNewAttachmentData 2018-04-04 18:41:50 -04:00
Daniel Gasienica ce8fe0d345 Add Signal.Startup module 2018-04-04 18:10:52 -04:00
colefranz 234411cb29 issue-2023: introduce unit tests for inbox view
There were no unit tests for the file at all so I added some simple ones
mostly focused on my changes.
2018-04-04 15:42:13 -04:00
Daniel Gasienica 8474f3cf7f Use create* prefix to clarify curried functions 2018-04-03 15:25:24 -04:00
Daniel Gasienica 9c7afab21b Clear database before message view tests 2018-04-03 11:45:11 -04:00
Daniel Gasienica 9065b647ad Run migrations before clearing database during tests 2018-04-03 11:45:11 -04:00
Daniel Gasienica 01480f5dd2 Improve formatting 2018-04-03 11:45:11 -04:00
Daniel Gasienica d6ea158e46 Avoid dangerouslyCreateAndAdd in MessageView test 2018-03-27 19:52:18 -04:00
Daniel Gasienica 83c979fb84 Rename createTemporary to dangerouslyCreateAndAdd
Class: `ConversationController`.

This function should not be used in application code as it creates potentially
invalid `Conversation` instances in our global conversation collection. We keep
making it available for testing purposes.
2018-03-27 19:52:17 -04:00
Daniel Gasienica 867f73b80a Use double quotes for identifiers in error messages 2018-03-26 16:38:34 -04:00
Daniel Gasienica 06e7bca276 Use new stringToArrayBuffer function 2018-03-26 16:38:34 -04:00
Daniel Gasienica 10afcf1bb0 Add Attachments.deleteData 2018-03-26 16:38:34 -04:00
Daniel Gasienica 9b636a1885 Add test for Attachments.readData 2018-03-26 16:38:34 -04:00
Daniel Gasienica f6f0359a61 Use assert.deepEqual instead of Lodash isEqual 2018-03-26 16:38:34 -04:00
Daniel Gasienica aba261122f 🎨 Use camelCase for mutable variable 2018-03-26 16:38:34 -04:00
Daniel Gasienica 1c8123ff1a Move writeAttachmentData into Attachments
Encapsulates all attachment operations that require Node.js / Electron APIs,
e.g. file system access.
2018-03-26 16:38:34 -04:00
Daniel Gasienica 6355c54114 Return relative path from writeAttachmentData
This will make our app more robust to changes in location on the file system.
2018-03-26 16:38:34 -04:00
Daniel Gasienica 1262d1d696 Shorten prefix to 2 characters
Using 2 hex characters [0-9a-f] will give us 16 * 16 = 256 root folders which
seems more manageable than 4096 (16^3). Assuming a user has 10,000 attachments,
they should roughly distribute at ~40 per folder with prefix length 2 rather
than ~2.5 per folder with a prefix of 3.
2018-03-26 16:38:34 -04:00
Daniel Gasienica 2cd3d5ac16 Add Message schema version 3 2018-03-26 16:38:34 -04:00
Daniel Gasienica ebe2a769c9 Add Attachment.migrateDataToFileSystem 2018-03-26 16:38:34 -04:00
Daniel Gasienica 1283c77518 Switch from hashed to random attachment file names
Using hashes, we get the benefit of deduplication but if a user receives two
messages with the same attachment, deleting one would delete it for both since
they are only stored once. To avoid the complexity of tracking number of
references, we simply generate random file names similar to iMessage on MacOS
(?) and Signal Android.
2018-03-26 16:38:34 -04:00
Daniel Gasienica d9de6dacba Add writeAttachmentData module 2018-03-26 16:38:34 -04:00
Vincent 5b5903c70e Fix link to Signal update location
Fixes #2043.
2018-03-23 12:15:52 -07:00
Scott Nonnenberg cea42bde7d Encryption support for backup and restore
Also moved to the _ prefix in backup.js for all private methods exported
for testing.
2018-03-20 11:53:54 -07:00
Scott Nonnenberg 6d8f4b7b6e Backup: zipped messages.json, flat attachments dir
Backup creates, in a target directory:
  - An attachments folder, with all attachments, each named for their
    parent message's id - a GUID. If there is more than one attachment
    in a given message,  each attachment beyond the first will end with
    '-N', zero-indexed.
  - A file named messages.zip. It contains exactly what went to disk in
    the original export code, but zipped up.

Export is now only 'light,' and in this new messages.zip format.

Import supports both the new format and the old format. If the target
directory has a messages.zip file, we'll treat it as the new format.

Next up: Encrypting attachments and the messages.zip!
2018-03-20 11:53:22 -07:00
Scott Nonnenberg e583434366 Refactor: Move Backup under window.Signal 2018-03-20 11:53:19 -07:00
Daniel Gasienica 8dfaa5619f Prefix private functions with underscore 2018-03-19 19:27:59 -04:00
Daniel Gasienica ed336d31d7 Move schema versioning from Attachment to Message 2018-03-19 19:27:59 -04:00
Daniel Gasienica b9e9f5e19a 🎨 withInheritedSchemaVersion to inheritSchemaVersion 2018-03-19 19:27:59 -04:00
Daniel Gasienica c27746b79e Add Message.withInheritedSchemaVersion 2018-03-19 19:27:59 -04:00
Daniel Gasienica e9e46464c2 Add SchemaVersion type 2018-03-19 19:27:59 -04:00
Daniel Gasienica add4b11df3 Skip invalid attachments and make function sync 2018-03-19 19:27:59 -04:00
Daniel Gasienica 3dfc823716 Add Attachment.removeSchemaVersion 2018-03-19 19:27:59 -04:00
Scott Nonnenberg a728c9efbf Remove all mention of obsolete safety-number-approval setting 2018-03-14 14:42:15 -07:00
Scott Nonnenberg 26c273618a Refactor: db tasks to database.js, log delete to modules/logs.js 2018-03-14 14:42:15 -07:00
Daniel Gasienica 43b47fd349 Avoid ensure-error for privacy reasons
Example:

```
> node
> const nonError = {foo: 'i-am-private'};
undefined

// before
> util.inspect(nonError);
'{ foo: \'i-am-private\' }'

// after
> nonError.toString()
'[object Object]'
>
```
2018-03-08 16:23:51 -05:00
Daniel Gasienica 44b81f68dd Remove privacy redaction from Errors.toLogFormat 2018-03-08 16:23:51 -05:00
Daniel Gasienica e71246a9e3 Add tests for Privacy module 2018-03-08 16:23:51 -05:00
Daniel Gasienica 49e0850fb2 Extract Privacy module
Centralizes how we redact sensitive information.
2018-03-08 16:23:51 -05:00
Daniel Gasienica be3e4d86c2 Add Errors.toLogFormat
Allows errors to be formatted and sanitized for logging. Removes sensitive paths
such as the app root directory.

Ideally, this module would be called singular `Error` but that is already a
global name. Using `Errors` plural is  similar to Java convention for utilities
such as `Arrays`, `Collections`, `Files`, etc. See:
https://stackoverflow.com/a/11673838
2018-03-08 16:22:38 -05:00
Daniel Gasienica 52f7de6a10 Add debuglogs module 2018-03-08 16:21:27 -05:00
Daniel Gasienica 1e2cd3ae1f Rename ‘File a Bug’ to ‘Report an Issue’
This makes it more consistent with ‘Report an issue’ under View > Debug Log.

Not using ellipsis as menu item doesn’t require user confirmation:
https://stackoverflow.com/a/637708
2018-03-08 16:21:27 -05:00
Daniel Gasienica 85b121aca4 Rename shouldShowAudioNotificationSetting
Use `isAudioNotificationSupported` to make it less presentation layer specific.
2018-03-05 10:29:11 -05:00
Daniel Gasienica 105eb95391 Add tests for Settings.shouldShowAudioNotificationSetting 2018-03-05 10:29:11 -05:00
Daniel Gasienica 40ee88ead3 Remove ‘Ctrl+,’ keyboard shortcut on Windows & Linux (#2099) 2018-03-02 16:46:04 -05:00