Implement MSC3873 to handle escaped dots in push rule keys#3134
Implement MSC3873 to handle escaped dots in push rule keys#3134andybalaam merged 26 commits intomatrix-org:developfrom
Conversation
andybalaam
left a comment
There was a problem hiding this comment.
Some questions, and an ask for more unit tests.
This is ~80% slower than the basic split(".").
This is ~50% slower than a simple split(".").
|
The downstream test failed https://github.com/matrix-org/matrix-js-sdk/actions/runs/4260935958/jobs/7414674597 (i.e. matrix-react-sdk tests failed with this change) |
matrix-org/matrix-react-sdk#10237 should fix it (passes locally). I'm not sure if CI will pick-up on the "fix" though or not? |
Although this now seems to be failing lint because we don't provide the |
|
@clokep are you blocked on me/us for this? Give me a ping if so. |
No, just trying to figure out how to refactor tests after the changes I made. |
|
@andybalaam I think this is ready for another look! |
| if (!newRules.global) newRules.global = {} as PushRuleSet; | ||
| if (!newRules.global.override) newRules.global.override = []; | ||
| if (!newRules.global.override) newRules.global.underride = []; | ||
| if (!newRules.global.underride) newRules.global.underride = []; |
There was a problem hiding this comment.
This seems to have been a separate, long-standing bug?
There was a problem hiding this comment.
Yeah, how exciting. What would the symptoms have been? Maybe we can find an issue to close....
There was a problem hiding this comment.
It was added in #2873, but that also added (on line 191) a newRules.global.underride ?? [], likely to solve the same problem? 🤷 (I don't think this would have a user-visible bug.)
| if (!newRules) newRules = {} as IPushRules; | ||
| if (!newRules.global) newRules.global = {} as PushRuleSet; | ||
| if (!newRules.global.override) newRules.global.override = []; | ||
| if (!newRules.global.room) newRules.global.room = []; | ||
| if (!newRules.global.sender) newRules.global.sender = []; | ||
| if (!newRules.global.underride) newRules.global.underride = []; |
There was a problem hiding this comment.
This was copied from rewriteDefaultRules, but it might make more sense to just skip any that are undefined instead of mutating the input value?
There was a problem hiding this comment.
Seems fine like this, if it's more consistent.
* Implement MSC3758: a push rule condition to match event properties exactly ([\matrix-org#3179](matrix-org#3179)). * Enable group calls without video and audio track by configuration of MatrixClient ([\matrix-org#3162](matrix-org#3162)). Contributed by @EnricoSchw. * Updates to protocol used for Sign in with QR code ([\matrix-org#3155](matrix-org#3155)). Contributed by @hughns. * Implement MSC3873 to handle escaped dots in push rule keys ([\matrix-org#3134](matrix-org#3134)). Fixes undefined/matrix-js-sdk#1454. * Fix spec compliance issue around encrypted `m.relates_to` ([\matrix-org#3178](matrix-org#3178)). * Fix reactions in threads sometimes causing stuck notifications ([\matrix-org#3146](matrix-org#3146)). Fixes element-hq/element-web#24000. Contributed by @justjanne.
This implements MSC3873 which allows for disambiguating the
keyused inevent_matchbetween fields that have a.in them vs. using.as a field separator.The MSC doesn't have any backwards compatibility clauses as none of the default push rules are affected. Some custom rules might behave differently after this change. This would fix #1454.
Checklist
Sign-off given on the changes (see CONTRIBUTING.md)Here's what your changelog entry will look like:
✨ Features