mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-03 06:32:47 +00:00
Update getting pushrules, add tests, tweak pushrules (#2705)
This PR - adds tests for `evaluatePushrules` - removes the need for the UserAPI on the `OutputStreamEventConsumer` (for easier testing) - adds a method to get the pushrules from the database - adds a new default pushrule for `m.reaction` events (and some other tweaks)
This commit is contained in:
parent
42a82091a8
commit
64472d9aab
11 changed files with 255 additions and 82 deletions
|
@ -7,8 +7,9 @@ func defaultOverrideRules(userID string) []*Rule {
|
|||
mRuleInviteForMeDefinition(userID),
|
||||
&mRuleMemberEventDefinition,
|
||||
&mRuleContainsDisplayNameDefinition,
|
||||
&mRuleTombstoneDefinition,
|
||||
&mRuleRoomNotifDefinition,
|
||||
&mRuleTombstoneDefinition,
|
||||
&mRuleReactionDefinition,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +21,7 @@ const (
|
|||
MRuleContainsDisplayName = ".m.rule.contains_display_name"
|
||||
MRuleTombstone = ".m.rule.tombstone"
|
||||
MRuleRoomNotif = ".m.rule.roomnotif"
|
||||
MRuleReaction = ".m.rule.reaction"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -96,7 +98,7 @@ var (
|
|||
{
|
||||
Kind: SetTweakAction,
|
||||
Tweak: HighlightTweak,
|
||||
Value: false,
|
||||
Value: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -120,10 +122,25 @@ var (
|
|||
{
|
||||
Kind: SetTweakAction,
|
||||
Tweak: HighlightTweak,
|
||||
Value: false,
|
||||
Value: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
mRuleReactionDefinition = Rule{
|
||||
RuleID: MRuleReaction,
|
||||
Default: true,
|
||||
Enabled: true,
|
||||
Conditions: []*Condition{
|
||||
{
|
||||
Kind: EventMatchCondition,
|
||||
Key: "type",
|
||||
Pattern: "m.reaction",
|
||||
},
|
||||
},
|
||||
Actions: []*Action{
|
||||
{Kind: DontNotifyAction},
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
func mRuleInviteForMeDefinition(userID string) *Rule {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue