Commit graph

5775 commits

Author SHA1 Message Date
Luke Barnard
33df4fafaa Merge pull request #1221 from matrix-org/luke/feature-rte-autoemoji
Implement disabled-by-default setting for auto-replacement of plainte…
2017-07-13 17:51:34 +01:00
Luke Barnard
dcc4db53f9 Async functions now return bluebird promises, remove redundant Promise.resolve 2017-07-13 17:51:14 +01:00
Luke Barnard
c47398e7fe Merge branch 'develop' into luke/fix-autcompleter-promises 2017-07-13 17:48:10 +01:00
Luke Barnard
5a701d3b06 Merge pull request #1220 from matrix-org/rav/async_to_bluebird
Transform `async` functions to bluebird promises
2017-07-13 17:46:22 +01:00
Luke Barnard
d97de4d576 Implement disabled-by-default setting for auto-replacement of plaintext emojis
FTR a list of plaintexts and their unicode equivalents can be found here - https://github.com/vector-im/riot-web/issues/4554#issuecomment-314374303

Pressing space after a matching emoji will replace the plaintext emoji with the equivalent unicode emoji.
2017-07-13 17:37:43 +01:00
Luke Barnard
f78a49b3a9 Do reflect in the same map 2017-07-13 17:20:17 +01:00
Richard van der Hoff
4d83150855 Transform async functions to bluebird promises
It turns out that the assertion made in
https://github.com/matrix-org/matrix-react-sdk/pull/1213 about `async`
functions returning bluebird promises was only correct when babel used an
inline version of the `asyncToGenerator` helper; in react-sdk we are using
`babel-transform-runtime` which means that we use a separate
`babel-runtime/helpers/asyncToGenerator`, which returns a native (or core-js)
Promise.

This meant that we were still in the situation where some methods returned
native Promises, and some bluebird ones, which is exactly the situation I
wanted to resolve by switching to bluebird in the first place: in short,
unless/until we get rid of all code which assumes Promises have a `done` method
etc, we need to make sure that everything returns a bluebird promise.

(Aside: there was debate over whether in the long term we should be trying to
wean ourselves off bluebird promises by assuming all promises are native. The
conclusion was that the complexity hit involved in doing so outweighed any
benefit of a potential future migration away from bluebird).
2017-07-13 17:10:08 +01:00
Luke Barnard
c9f3a12693 Fix Autocompleter promises
Use bluebird instead of the now removed "q" library.

Also, make sure we timeout and then `reflect` to effectively do an `allSettled` that waits for all promises to either be resolved or rejected. Then we filter for those that are fulfilled and return the completions.
2017-07-13 16:51:14 +01:00
Luke Barnard
7fc10789fc Merge pull request #1217 from matrix-org/luke/fix-rte-html-links
Improve RTE HTML link handling
2017-07-13 13:57:58 +01:00
Luke Barnard
f1a4209d6b Fix indentation 2017-07-13 13:47:08 +01:00
Luke Barnard
5826b6f22a Instead of sending HTML for any Entity, only send HTML for Links
Otherwise emoji messages are sent as HTML, needlessly
2017-07-13 13:41:17 +01:00
Luke Barnard
be045a6dc0 Interpret whitespace after entity as the end of the entity
The easiest way to stop the user from inserting whitespace onto the end of an entity is to toggle the entity state of the whitespace that was just entered. This allows the user to continue drafting a message without editing the link content.

This is for pasted `<a>` tags that have been copied from a website. We probably also want to be storing entities for substrings of content that are determined to be URLs.
2017-07-13 13:28:51 +01:00
Luke Barnard
4b96963408 Send HTML if there are any entities present in the composer
This is so that pasted HTML links that are represented as entities are sent as HTML.
2017-07-13 13:27:49 +01:00
Luke Barnard
55e1202c09 Decorate pasted links so that they look like links
By default, draftjs will represent pasted `<a>` tags as `LINK` entities, but it doesn't do any default decoration of these links. Add a decorator to do so.

Most of this was taken from https://github.com/facebook/draft-js/blob/v0.8.1/examples/link/link.html (note the version, v0.8.1).
2017-07-13 13:26:13 +01:00
David Baker
2a68cce3d5 Merge pull request #1216 from matrix-org/dbkr/history_save_unload_nullcheck
Prevent exception on page unload
2017-07-13 12:38:28 +01:00
Richard van der Hoff
086304532e Merge pull request #1213 from matrix-org/rav/bluebird
Switch matrix-react-sdk to bluebird
2017-07-13 12:06:11 +01:00
David Baker
917133219f Remove sentHistory save altogether 2017-07-13 11:53:22 +01:00
Luke Barnard
ce0f9e8803 Merge pull request #1214 from matrix-org/luke/fix-rte-remove-old-disable-md-setting
Remove `disableMarkdown` setting
2017-07-13 11:33:42 +01:00
Luke Barnard
4d844ebc34 Merge pull request #1215 from matrix-org/luke/remove-old-composer
Remove MessageComposerInputOld
2017-07-13 11:33:23 +01:00
David Baker
1e80edb43c Prevent exception on page unload
Null check when saving sent history
2017-07-13 11:30:25 +01:00
Luke Barnard
04dd98e6e9 Remove references to tabComplete, which are now redundant
(since the old composer has been removed)
2017-07-13 10:16:59 +01:00
Luke Barnard
0e12e384cb Remove TabComplete-related files 2017-07-13 10:16:42 +01:00
Luke Barnard
441954c8c1 Remove i18n for "Unknown command" 2017-07-13 09:55:11 +01:00
Luke Barnard
4cc8b5621d Merge pull request #1212 from matrix-org/luke/fix-ctrl-k
Enable ctrl+k room filter focus
2017-07-12 18:20:45 +01:00
Richard van der Hoff
33f330d434 Manual fixup for remaining q incantaions
* don't try to use `finally` as a static method
* work around absence of `allSettled`
2017-07-12 18:05:40 +01:00
Richard van der Hoff
0d7cc59d99 replace q method calls with bluebird ones
```
find src test -name '*.js' |
    xargs perl -i -pe 's/q\.(all|defer|reject|delay|try|isFulfilled)\(/Promise.$1(/'
```
2017-07-12 18:05:40 +01:00
Richard van der Hoff
0254d2b3a2 q(...) -> Promise.resolve
```
find src test -name '*.js' | xargs perl -i -pe 's/\b[qQ]\(/Promise.resolve(/'
```
2017-07-12 18:05:08 +01:00
Richard van der Hoff
a06bd84213 replace imports of q with bluebird
update `package.json`

```
find src test -name '*.js' |
   xargs perl -i -pe 'if (/require\(.[qQ].\)/) { $_ = "import Promise from '\''bluebird'\'';\n"; }'

find src test -name '*.js' |
   xargs perl -i -pe 'if (/import [qQ]/) { $_ = "import Promise from '\''bluebird'\'';\n"; }'
```
2017-07-12 18:05:08 +01:00
Luke Barnard
6ff924fc0d Remove MessageComposerInputOld 2017-07-12 18:03:13 +01:00
Luke Barnard
0585fa048f Remove disableMarkdown setting
This was used by the old composer to control whether to interpret text as markdown prior to sending.

The new setting is `MessageComposerInput.isRichTextEnabled`.
2017-07-12 17:35:19 +01:00
Luke Barnard
6547a55852 Update to reflect previous implementation
Which was originally a74bbb424c
2017-07-12 17:12:57 +01:00
David Baker
3093f2d6fb Merge pull request #1211 from matrix-org/rav/use_react_test_utils
Use matrix-react-test-utils rather than our own impl
2017-07-12 16:44:25 +01:00
David Baker
a48c7d2364 Only allow http and https widget URLs 2017-07-12 14:16:47 +01:00
Luke Barnard
0dbd1d988e Enable ctrl+k room filter focus
By using the `focus_room_filter` dispatch
2017-07-12 13:51:55 +01:00
David Baker
918f5abe81 Lint correctly 2017-07-12 10:34:50 +01:00
David Baker
53316a76f4 Sandbox app iframes 2017-07-12 10:22:14 +01:00
Richard van der Hoff
7455002b1a InteractiveAuthDialogTest: increase timeout
Blindly increase the number of attempts, because it's failing on travis, but
not on my dev box...
2017-07-12 00:24:00 +01:00
Richard van der Hoff
928287b8fc Bump to matrix-react-test-utils 0.1.1
... because 0.1.0 was broken
2017-07-12 00:02:52 +01:00
Richard van der Hoff
7ae4e96e4d Merge pull request #1207 from matrix-org/rav/fix_dispatcher_race
Fix a race in session loading code
2017-07-11 23:21:33 +01:00
Richard van der Hoff
30ef6d4932 Merge pull request #1210 from matrix-org/t3chguy/test-crossplatform
use npm scripts arg passing instead of $KARMAFLAGS to make cross-compat
2017-07-11 23:18:53 +01:00
Richard van der Hoff
ab61b6b1b6 Use matrix-react-test-utils rather than our own impl
waitForRenderedDOMComponentWithTag is now in matrix-react-test-utils.
2017-07-11 23:14:56 +01:00
Michael Telatynski
7473c654d5
use npm scripts arg passing instead of $KARMAFLAGS to make cross-compat 2017-07-11 22:54:18 +01:00
David Baker
569ea909c4 Merge pull request #1209 from matrix-org/luke/fix-emoji-support-zwj
Update `unicodeToImage` to maintain compatibility with emojione
2017-07-11 18:38:54 +01:00
David Baker
eb4e4a66ff Merge pull request #1206 from matrix-org/rav/login_unmounted_guard
Give Login an unmounted guard
2017-07-11 18:37:50 +01:00
Luke Barnard
0df144cb62 Update unicodeToImage to maintain compatibility with emojione
We recently updated our version of emojione but this update included the addition of emoji represented in unicode with ZWJ (Zero-Width-Joiners). These ZWJs are not present in the asset file names, so any emoji with ZWJ in them were just not found (404 on the web client).

This updates `unicodeToImage` to be compatible with emojione 2.2.7 so that the correct filenames are used when converting from unicode to <img>.
2017-07-11 18:27:35 +01:00
Luke Barnard
3bab720a7b Merge pull request #1208 from matrix-org/rav/timelinepanel_test_flakiness
Fix a flaky test in the timelinepanel code
2017-07-11 18:10:55 +01:00
Richard van der Hoff
1139dd2be5 Fix a flaky test in the timelinepanel code
Sometimes it was possible for there to be a scroll event before the initial
pagination completed, which then upset the rest of the test. Just give it a few
ms to sort itself out instead.
2017-07-11 17:34:46 +01:00
Richard van der Hoff
f5f1fe6ae6 Fix a race in session loading code
it was possible for on_logging_in to get dispatched *after* on_logged_in,
causing the app to wedge. Fix it by dispatching on_logging_in synchronously.
2017-07-11 17:09:06 +01:00
Richard van der Hoff
67372d4fed Give Login an unmounted guard 2017-07-11 17:04:19 +01:00
Luke Barnard
af3b6484cd Merge pull request #1196 from matrix-org/dbkr/groups_better_groupview
Add more features to Group View
2017-07-11 17:03:47 +01:00