Commit graph

4158 commits

Author SHA1 Message Date
Daniel Gasienica
1206b3c448 Remove Conversation Message Preview After Message Has Expired
- [x] Skip timestamp update for `verified-change` and expiring messages to
      prevent them to bump to the top of the conversation list.
- [x] Skip message preview (`lastMessage`) update for `verified-change` messages
      since they don’t contain any message body.
- [x] Reset last message if conversation is empty.

Fixes https://github.com/signalapp/Signal-Desktop/issues/980.
2018-04-13 14:27:02 -04:00
Daniel Gasienica
5f8148d3da Bind to Conversation lazily to prevent style guide errors 2018-04-13 14:26:01 -04:00
Daniel Gasienica
560cc4e149 Set dynamic parameter last 2018-04-11 19:46:23 -04:00
Daniel Gasienica
0daccee209 Enable TSLint Mocha rules 2018-04-11 19:45:48 -04:00
Daniel Gasienica
9d159da79c Add Microsoft contributed TSlint rules: tslint-microsoft-contrib 2018-04-11 19:45:31 -04:00
Daniel Gasienica
0902c94093 Reset last message after message has expired
Fixes #980.
2018-04-11 19:34:21 -04:00
Daniel Gasienica
ad05efb7a0 Expose Signal.Types.Conversation 2018-04-11 19:34:21 -04:00
Daniel Gasienica
44debd123d Add basic implementation of Conversation.updateFromLastMessage 2018-04-11 19:34:21 -04:00
Daniel Gasienica
cca5db3237 Remove unused import 2018-04-11 19:25:38 -04:00
Daniel Gasienica
1659354f51 Expand Message type definitions 2018-04-11 19:25:38 -04:00
Daniel Gasienica
b50c55172d Add MIME type 2018-04-11 19:25:38 -04:00
Daniel Gasienica
65bf34d1b8 Add basic Attachment type definition 2018-04-11 19:25:38 -04:00
Daniel Gasienica
fa36e1b7a7 Configure EditorConfig for TypeScript 2018-04-11 19:25:38 -04:00
Daniel Gasienica
f25a579f32 Add basic Message type definition 2018-04-11 19:25:38 -04:00
Daniel Gasienica
9513e90a84 Fix TS error regarding window 2018-04-11 19:25:30 -04:00
Daniel Gasienica
bcd3e26377 Fix TS warning about appendChild 2018-04-11 19:25:30 -04:00
Daniel Gasienica
27f205e0a3 Fix TS error regarding SharedArrayBuffer 2018-04-11 19:25:30 -04:00
Daniel Gasienica
3a05201501
Improve URL Auto-Linking In Messages (#2240)
As a user, I’d like the app to autolink as many possible URL formats I write in
messages as possible, e.g.

- [x] URLs without protocol: `github.com`
- [x] URLs with in different languages (Unicode):
  - [x] `https://zh.wikipedia.org/zh-hans/信号`
  - [x] `https://ru.wikipedia.org/wiki/Сигнал`
- [x] URLs with single quotes: `https://www.example.com/this-couldn't-be-true`
- [x] Messages with URLs right after special characters:
      `wink ;)https://www.youtube.com/watch?v=oHg5SJYRHA0`
- [x] URLs with square brackets:
      `https://www.example.com/test.html?foo=bar&baz[qux]=quux`
- [x] **Infrastructure:** Include TypeScript files in build.
- [x] **Infrastructure:** Rename `ts/test` to `ts/styleguide`.
- [x] **Infrastructure:** Decouple linting from testing.
- [x] **Infrastructure:** Run all tests in CI.
- [x] **Infrastructure:** Compile TypeScript on CI.

### Dependencies
- Forked `link-text` to disable HTML escaping: It only has the minimum required
  dependencies:
    - `linkify-it`: Best-in-class link detection library with support for
                    Unicode/IDN. Popular alternative: `linkifyjs`.
                    Doesn’t handle Unicode in URLs.
    - ~~`escape-html`: Standalone dependency for escaping HTML.~~
    - `uc.micro`: Standalone dependency of Unicode data files.

### Known Issues

We don’t auto-link trailing exclamation points which in most cases would be
expected to be part of the message body rather than the link.
**Counterexample:** `https://en.wikipedia.org/wiki/Mother!`.
N.B. GitHub doesn’t do this right either.

Fixes #598.
2018-04-11 17:31:16 -04:00
Daniel Gasienica
55fc21505e Rename ts/test to ts/styleguide 2018-04-11 16:36:42 -04:00
Daniel Gasienica
96c07c6373 Bump timeout of debuglogs test 2018-04-11 16:36:42 -04:00
Daniel Gasienica
99dbdc3506 Include compiled TypeScript JavaScript files in build 2018-04-11 16:36:42 -04:00
Daniel Gasienica
d6436de3bd Organize npm scripts
Combine `yarn grunt jshint` and `yarn grunt jscs` into `yarn grunt lint`.
2018-04-11 16:36:42 -04:00
Daniel Gasienica
513d9a5d5c Run Node.js tests early 2018-04-11 16:36:42 -04:00
Daniel Gasienica
7cb43c9f7f Add TSLint rules 2018-04-11 16:36:42 -04:00
Daniel Gasienica
6f4d0e1449 Use project for TSLint 2018-04-11 16:36:42 -04:00
Daniel Gasienica
e052d1df7b Use generic array syntax for consistency
Always prefer `Array<T>` over `T[]` for primitive types only.
2018-04-11 16:36:42 -04:00
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`).
2018-04-11 16:36:42 -04:00
Daniel Gasienica
80de7bbd5c Compile TypeScript files on Travis CI 2018-04-11 16:36:42 -04:00
Daniel Gasienica
d6b40a3e94 Explicitly point to TSLint configuration
AppVeyor seems to ignore our configuration.
2018-04-11 16:36:42 -04:00
Daniel Gasienica
b8bbed3ec9 Compile and lint TypeScript on AppVeyor 2018-04-11 16:36:42 -04:00
Daniel Gasienica
d7b845326d ESLint auto-fix link_text 2018-04-11 16:36:42 -04:00
Daniel Gasienica
9d41b86162 Remove escaping from linkText
We leverage jQuery’s HTML escaping in `$.html(…)`.
2018-04-11 16:36:42 -04:00
Daniel Gasienica
f04c65088b Fork link-text module 2018-04-11 16:36:42 -04:00
Daniel Gasienica
d9381c543e Add linkify-it dependency 2018-04-11 16:36:42 -04:00
Daniel Gasienica
ac50713f86 Improve auto-linking of URLs in messages
Fixes #598.
2018-04-11 16:36:42 -04:00
Daniel Gasienica
144cb58a47 Add HTML module for rendering messages 2018-04-11 16:36:42 -04:00
Daniel Gasienica
7d4ef9315b Add yarn test-ts 2018-04-11 16:36:42 -04:00
Daniel Gasienica
f38370f40e Add custom type definition for link-text 2018-04-11 16:36:42 -04:00
Daniel Gasienica
6f8dee402d Add @types/mocha 2018-04-11 16:36:42 -04:00
Daniel Gasienica
7ac4bee959 Add @types/chai 2018-04-11 16:36:42 -04:00
Daniel Gasienica
78ba4eddc1 Add @types/lodash 2018-04-11 16:36:42 -04:00
Daniel Gasienica
f5641fe6d6 Add link-text dependency
It only has the minimum required dependencies:
- `linkify-it`: Best-in-class link detection library with support for
                Unicode/IDN.
- `escape-html`: Standalone dependency for escaping HTML.
- `uc.micro`: Standalone dependency of Unicode data files.
2018-04-11 16:36:42 -04:00
Daniel Gasienica
9b22e0667a
Redact More Variants Of Paths In Stack Traces (#2229)
- [x] Redact stack traces with both forward and backslashes.
- [x] Redact paths with escaped forward slashes.
- [x] Redact URL-encoded paths.
- [x] Minor: Use `is` vs Lodash `is*` for type checking.
- [x] Minor: Rename `Path` to `path`, etc.
- [x] Add ESLint `quotes` rule to allow double quotes to avoid escaping single quotes.
- [x] Consistently use single quotes to denote identifiers in error messages,
      e.g. `'foo' is required`.
2018-04-11 16:35:54 -04:00
Daniel Gasienica
24f4ad53bc Use single quotes for identifiers 2018-04-11 15:54:32 -04:00
Daniel Gasienica
819671a23a Add ESLint quotes rule 2018-04-11 15:41:40 -04:00
Daniel Gasienica
432a6ebd7f Redact file paths with escaped slashes 2018-04-11 15:30:59 -04:00
Daniel Gasienica
d41e3cd6fc Add test for regular _redactPath 2018-04-11 15:30:59 -04:00
Daniel Gasienica
a8a7525609 Redact stack traces with forward and backslashes 2018-04-11 15:30:59 -04:00
Daniel Gasienica
b0da7d965e Redact URL encoded file paths in stack traces 2018-04-11 15:30:59 -04:00
Daniel Gasienica
f2c9ccae90 Prefer is.* over Lodash is* functions 2018-04-11 15:30:59 -04:00