Travis Ralston
d3ce0cb82f
Convert src to ES6
...
The bulk of this is just export/import changes, though there's a couple pieces to highlight:
* We no longer use default exports. This is because it's discouraged by the JS community, though not in any official capacity.
* We now use `polyfillSuper` for some prototype inheritance because the tests, and sometimes webpack, break on "cannot call EncryptionAlgorithm without 'new'". It's very much a workaround, and definitely not needed when we use real classes.
There is some import shuffling to help keep the imports clean - this was done by my IDE.
2019-12-17 15:14:22 -07:00
Travis Ralston
1b877118ef
Only do one type check
2019-11-26 10:31:04 -07:00
Travis Ralston
aa37f697bf
Fix empty string handling in push notifications
...
Fixes https://github.com/vector-im/riot-web/issues/11460
Empty strings are falsey, and the state key match for a tombstone event is an empty string. Ergo, nothing happens because all the conditions fail.
2019-11-25 16:35:27 -07:00
Travis Ralston
c7be810e65
Appease the tests
2019-07-31 11:00:44 -06:00
Travis Ralston
101217cfb6
Appease the linter
2019-07-31 11:00:38 -06:00
Travis Ralston
5c2aa4677f
Support rewriting push rules when our internal defaults change
...
and change our internal default for tombstones
2019-07-31 10:52:44 -06:00
J. Ryan Stinnett
2525b5a5d8
Add default push rule to ignore reactions
...
This adds a default push rule to ignore reactions as proposed in
[MSC2153](https://github.com/matrix-org/matrix-doc/pull/2153 ). By adding it here
in the client directly, we can try out the idea early even if it hasn't appeared
in the user's HS yet.
Part of https://github.com/vector-im/riot-web/issues/10208
2019-07-04 14:41:04 +01:00
Travis Ralston
dc946dffbc
Add some words to explain why we do things the way we do
2019-05-03 11:19:46 -06:00
Travis Ralston
42f181cc7b
Appease the linter
2019-03-15 14:11:29 -06:00
Travis Ralston
b3d2d39b60
Add tombstone rule as a default rule in support of MSC1930
...
Part of https://github.com/vector-im/riot-web/issues/8447
See also https://github.com/matrix-org/matrix-doc/pull/1930
2019-03-15 14:07:15 -06:00
Travis Ralston
e323d917a4
Support default push rules for when servers are outdated
2019-03-15 14:06:28 -06:00
Travis Ralston
2f2deb5333
Expose the clear event content directly from an event
2019-03-05 14:04:51 -07:00
Travis Ralston
bcd4ad130c
Use the decrypted event content when checking the push rules
...
Otherwise we'll be looking at the encrypted source, and that doesn't help anyone.
2019-03-04 21:33:57 -07:00
Travis Ralston
ec18df2c2a
Move glob regex utilities out of the pushprocessor and into a more generic place
2018-12-05 18:01:12 -07:00
David Baker
7e1cea1ef6
Cache the joined member count for a room state
...
Pushrule evaluation needs the count of joined room members and
filtering the list for joined members takes a nontrivial amount
of time, but caching it is trivial, both code and memory wise.
2018-02-26 16:43:26 +00:00
Matthew Hodgson
38915eb7fc
fix NPE biting yannick due to broken rules
2018-01-25 18:41:36 +01:00
lukebarnard
9de8653936
Actually check the cache
2018-01-16 09:51:30 +00:00
lukebarnard
56612751f9
Handle underride and override rules with patterns
2018-01-15 15:16:22 +00:00
lukebarnard
751fe7349a
Fix case insensitivity on new RegExps
2018-01-15 14:54:51 +00:00
lukebarnard
e2e5f80298
Linting
2018-01-05 20:05:12 +00:00
lukebarnard
ca0ed50172
Optimise pushprocessor
...
by not [re]creating RegExps unnecessarily.
2018-01-05 19:56:27 +00:00
David Baker
52b575296c
Merge pull request #565 from matrix-org/dbkr/get_rule_by_id
...
Expose more functionality of pushprocessor
2017-11-02 13:49:00 +00:00
David Baker
978db89deb
Function for working out notif trigger permission
...
And make pushprocessor use this function
2017-11-02 12:04:55 +00:00
David Baker
b867afe772
lint
2017-11-01 19:48:12 +00:00
David Baker
e34fd89bb6
Expose more functionality of pushprocessor
...
This exposes a function to get rules by their ID and
ruleMatchesEvent to test whether a rule matches a given event.
2017-11-01 19:40:50 +00:00
David Baker
37ed9800c5
Fix sender_notification_permission cond
...
Don't assume all events have a sender, because they don't.
2017-10-25 11:10:55 +01:00
David Baker
e7886a55fe
lint
2017-10-23 16:50:01 +01:00
David Baker
e33b786f65
Support room notifs
...
Specifically, add support for the sender_notification_permission
push rule condition. Also delays calculating notification events
until after they're added to the timeline, as per comment.
2017-10-23 16:02:06 +01:00
David Baker
70c998dd55
Merge pull request #558 from matrix-org/dbkr/fix_glob_to_regex
...
Fix the glob-to-regex code
2017-10-16 14:04:14 +01:00
David Baker
d9addf84ef
Make unknown pushrule conditions not match
...
Unknown conditions previously were assumed to match, but given rules
can be added on the server as base rules, it's probably better to not
match unknown conditions.
2017-10-16 13:55:07 +01:00
David Baker
d89163110e
Fix the glob-to-regex code
...
It was only making one replacement so would fail for anything with
more than ine glob special char (eg. *foo would be fine, but *foo*
was broken)
2017-10-16 13:40:49 +01:00
David Baker
7bca05af64
eslint ---fix for prefer-const
2017-01-19 17:42:10 +00:00
Kegan Dougal
5abf6b9f20
Manually patch up files which were formatted wrong
...
`eslint --fix` expands `if` statements incorrectly (wrong indentation).
2017-01-13 11:50:00 +00:00
Kegan Dougal
7ed65407e6
Pass through eslint --fix
2017-01-13 10:49:32 +00:00
Kegan Dougal
ae6a409cc2
Move /lib to /src
2017-01-11 10:09:04 +00:00