-
-
Notifications
You must be signed in to change notification settings - Fork 590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement MSC3873 to handle escaped dots in push rule keys #3134
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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(".").
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One typo, looks great!
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! |
@@ -162,7 +168,7 @@ export class PushProcessor { | |||
if (!newRules) newRules = {} as IPushRules; | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to have been a separate, long-standing bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, how exciting. What would the symptoms have been? Maybe we can find an issue to close....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine like this, if it's more consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
* 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
key
used inevent_match
between 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