-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Update the actions of default rules instead of overriding. #1037
Conversation
The Matrix CS API, and synapse now supports setting the actions for default rules. Doing that makes managing the rules much simpler from a vector persepctive since the ON/LOUD/OFF toggle buttons can be implemented by setting the actions and enabling/disabling the default rules rather than overidding them. Overriding the default rules was difficult because it was not possible to intermingle the evaluation of user-specified rules with the default rules. So even though you could add a rule with the same conditions as a default rule, it would evaluate before *all* the other default rules. Also creating new rules under a im.vector namespace creates challenges if we want vector to cooperate with other matrix clients that want to provide a similar set of toggle switches for the push rules.
I've added some code for when vector downloads the push rules to migrate from the "im.vector" rules to setting the actions for the default ".m.*" rules. |
// "highlight: true/false, | ||
// } | ||
// If the actions couldn't be decoded then returns null. | ||
function decodeActions(actions) { |
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 is this function: https://github.com/matrix-org/matrix-js-sdk/blob/develop/lib/pushprocessor.js#L227
We should probably think about exposing it in the js sdk rather than duplicating the code.
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.
Hmm, I'm not sure if they are exactly the same function since this gives up if it doesn't understand the tweaks, or actions.
But I agree that we should think about moving some of this code into the SDK so that other client authors don't need to duplicate it.
otherwise looking good |
lgtm then |
Update the actions of default rules instead of overriding.
The Matrix CS API, and synapse now supports setting the actions for default
rules. Doing that makes managing the rules much simpler from a vector
persepctive since the ON/LOUD/OFF toggle buttons can be implemented by
setting the actions and enabling/disabling the default rules rather than
overidding them.
Overriding the default rules was difficult because it was not possible
to intermingle the evaluation of user-specified rules with the default
rules. So even though you could add a rule with the same conditions as a
default rule, it would evaluate before all the other default rules.
Also creating new rules under a im.vector namespace creates challenges
if we want vector to cooperate with other matrix clients that want to
provide a similar set of toggle switches for the push rules.