Commit graph

3653 commits

Author SHA1 Message Date
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
Daniel Gasienica 2ee78ec556 Prefer path over Path 2018-04-11 15:30:59 -04:00
Scott Nonnenberg 8467352994
Rename file for Whisper.ReactWrapperView (#2232) 2018-04-11 09:30:28 -07:00
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
2018-04-06 08:13:00 -07:00
Scott Nonnenberg 96bd90a4e0
Simplify assignment; add warning to preload.js about Style Guide 2018-04-05 17:16:15 -07:00
Scott Nonnenberg 05303233fb
window.Signal.React -> window.Signal.Components 2018-04-05 16:10:59 -07:00