Commit Graph

302 Commits (e99192dca745dc46c81de75424e2d7a54b3cdedc)

Author SHA1 Message Date
Scott Nonnenberg 054d3887a1
Quotes: The full pipeline into the database
1. MessageReceiver always pulls down thumbnails included in quotes
2. Message.upgradeSchema has a new schema that puts all thumbnails on
   disk just like happens with full attachments.
3. handleDataMessage pipes quote from dataMessage into the final message
   destined for the database
7 years ago
Scott Nonnenberg e69586200a
Unleash eslint on message_receiver.js - lots of change 7 years ago
Scott Nonnenberg 21bf02c94d
Fixed examples in Quote.md, rough Android visuals 7 years ago
Scott Nonnenberg ae043bf239
In iOS theme, join attachment bubble with caption bubble 7 years ago
Scott Nonnenberg 3a76c3c86e
Styleguide: Incoming/outgoing attachments of all types 7 years ago
Daniel Gasienica ad05efb7a0 Expose `Signal.Types.Conversation` 7 years ago
Daniel Gasienica 96c07c6373 Bump timeout of `debuglogs` test 7 years ago
Daniel Gasienica 15d221ae0e Simplify testing and linting
Separate linting from testing as follows:

- `yarn jscs`: Run JSCS.
- `yarn jshint`: Run JSHint.
- `yarn lint`: Run all linters, i.e. ESLint, TSLint, JSHint, and JSHint.

- `yarn test-node`: Run Mocha tests in Node.js environment.
- `yarn test-electron`: Run tests in Electron environment via Grunt.
- `yarn test`: Run all tests.

CI
- Align Travis and AppVeyor scripts as much as possible.
- Run linting before tests to fail fast.
- Run Node.js (headless and fast) tests first.
- Run Electron tests last (Travis seems to require custom setup in `travis.sh`).
7 years ago
Daniel Gasienica 24f4ad53bc Use single quotes for identifiers 7 years ago
Daniel Gasienica 432a6ebd7f Redact file paths with escaped slashes 7 years ago
Daniel Gasienica d41e3cd6fc Add test for regular `_redactPath` 7 years ago
Daniel Gasienica a8a7525609 Redact stack traces with forward and backslashes 7 years ago
Daniel Gasienica b0da7d965e Redact URL encoded file paths in stack traces 7 years ago
Daniel Gasienica 2ee78ec556 Prefer `path` over `Path` 7 years ago
Scott Nonnenberg c6c3b65bbc
Introduce React, TypeScript, TSLint and React-StyleGuidist (#2219)
Quite a bit of change here.

First, the basics:

- New dependencies were added: react, typescript, tslint, and react-styleguidist
- A new npm script: transpile. It uses typescript to process .tsx files in js/react, putting .js files next to the original file. It's part of the watch functionality of grunt dev as well as the default task run with just grunt (used to build the app prior to release). A lighter-weight to get watch behavior when just working on React components is to run yarn transpile --watch.
- yarn run clean-transpile will remove generated .js files


Style guide via react-styleguidist. Example site: https://react-styleguidist.js.org/examples/basic/

- Start with yarn styleguide
- Component.md files right next to the .tsx file
- jsdoc-style comments are picked up and added to the generated part of the styleguide - the overall summary and a table listing methods and properties of the component
- It has hot-reloading!
- It uses webpack, which means that our app now pulls in webpack though we don't use it to generate anything for the production app.
- I did a bunch of work to enable the use of Backbone views in this context, which will allow us to move smoothly from the old world to the new. First, add all the permutations in the old way, and then slowly start to re-render those same views with React.

A bit of dependency cleanup to enable use in React components:

- moment was moved from our Bower dependencies to our npm dependencies, so it can be used in React components not running in a browser window.
- i18n was moved into the new commonjs format, so it can be used in React components even if window is not available.

Lastly, a bit of Gruntfile cleanup:

- Removal of Chrome App-era modifications of background.js
- Make jshint/jscs watch more targeted, since more and more we'll be using other tools
7 years ago
Scott Nonnenberg 05303233fb
window.Signal.React -> window.Signal.Components 7 years ago
Scott Nonnenberg 23537546fe
Big refactor: ts/ directory for all typescript, including react
Split out test-specific and general utility react components too.

And moved our test/legacy* files for the Style Guide into a styleguide/
subdirectory of test/.

I think we'll be able to live in this directory structure for a while.
7 years ago
Scott Nonnenberg 887abd75dd
Add missing shim, fix typo 7 years ago
Scott Nonnenberg 104a1ca5d4
Remove i18n.js from jshint run, fix missing semicolon 7 years ago
Daniel Gasienica 4c4443390a Rename `createImporter` to `createAttachmentDataWriter` 7 years ago
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.
7 years ago
Scott Nonnenberg f86a6ef752
Update style of i18n, pull it in via preload instead of .html 7 years ago
Daniel Gasienica bf67254cc5 Add `Message.createImporter` 7 years ago
Daniel Gasienica 5a6668e677 Add `Attachments.createWriteForExisting`
This function lets us choose where to write attachment to instead of picking
random name.
7 years ago
Daniel Gasienica efd673083d Rename `writeAttachmentData` to `writeNewAttachmentData` 7 years ago
Daniel Gasienica ce8fe0d345 Add `Signal.Startup` module 7 years ago
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.
7 years ago
Daniel Gasienica 8474f3cf7f Use `create*` prefix to clarify curried functions 7 years ago
Daniel Gasienica 9c7afab21b Clear database before message view tests 7 years ago
Daniel Gasienica 9065b647ad Run migrations before clearing database during tests 7 years ago
Daniel Gasienica 01480f5dd2 Improve formatting 7 years ago
Daniel Gasienica d6ea158e46 Avoid `dangerouslyCreateAndAdd` in `MessageView` test 7 years ago
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.
7 years ago
Daniel Gasienica 867f73b80a Use double quotes for identifiers in error messages 7 years ago
Daniel Gasienica 06e7bca276 Use new `stringToArrayBuffer` function 7 years ago
Daniel Gasienica 10afcf1bb0 Add `Attachments.deleteData` 7 years ago
Daniel Gasienica 9b636a1885 Add test for `Attachments.readData` 7 years ago
Daniel Gasienica f6f0359a61 Use `assert.deepEqual` instead of Lodash `isEqual` 7 years ago
Daniel Gasienica aba261122f 🎨 Use `camelCase` for mutable variable 7 years ago
Daniel Gasienica 1c8123ff1a Move `writeAttachmentData` into `Attachments`
Encapsulates all attachment operations that require Node.js / Electron APIs,
e.g. file system access.
7 years ago
Daniel Gasienica 6355c54114 Return relative path from `writeAttachmentData`
This will make our app more robust to changes in location on the file system.
7 years ago
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.
7 years ago
Daniel Gasienica 2cd3d5ac16 Add `Message` schema version 3 7 years ago
Daniel Gasienica ebe2a769c9 Add `Attachment.migrateDataToFileSystem` 7 years ago
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.
7 years ago
Daniel Gasienica d9de6dacba Add `writeAttachmentData` module 7 years ago
Vincent 5b5903c70e Fix link to Signal update location
Fixes #2043.
7 years ago
Scott Nonnenberg cea42bde7d
Encryption support for backup and restore
Also moved to the _ prefix in backup.js for all private methods exported
for testing.
7 years ago
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!
7 years ago
Scott Nonnenberg e583434366
Refactor: Move Backup under window.Signal 7 years ago