Update the actions of default rules instead of overriding.#1037
Merged
NegativeMjark merged 5 commits intodevelopfrom Mar 15, 2016
Merged
Update the actions of default rules instead of overriding.#1037NegativeMjark merged 5 commits intodevelopfrom
NegativeMjark merged 5 commits intodevelopfrom
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.
Contributor
Author
|
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) { |
Member
There was a problem hiding this comment.
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.
Contributor
Author
There was a problem hiding this comment.
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.
Member
|
otherwise looking good |
Member
|
lgtm then |
NegativeMjark
added a commit
that referenced
this pull request
Mar 15, 2016
Update the actions of default rules instead of overriding.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.