mirror of
https://github.com/matrix-org/dendrite
synced 2024-11-17 23:30:52 +01:00
64472d9aab
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)
39 lines
697 B
Go
39 lines
697 B
Go
package pushrules
|
|
|
|
func defaultContentRules(localpart string) []*Rule {
|
|
return []*Rule{
|
|
mRuleContainsUserNameDefinition(localpart),
|
|
}
|
|
}
|
|
|
|
const (
|
|
MRuleContainsUserName = ".m.rule.contains_user_name"
|
|
)
|
|
|
|
func mRuleContainsUserNameDefinition(localpart string) *Rule {
|
|
return &Rule{
|
|
RuleID: MRuleContainsUserName,
|
|
Default: true,
|
|
Enabled: true,
|
|
Pattern: localpart,
|
|
Conditions: []*Condition{
|
|
{
|
|
Kind: EventMatchCondition,
|
|
Key: "content.body",
|
|
},
|
|
},
|
|
Actions: []*Action{
|
|
{Kind: NotifyAction},
|
|
{
|
|
Kind: SetTweakAction,
|
|
Tweak: SoundTweak,
|
|
Value: "default",
|
|
},
|
|
{
|
|
Kind: SetTweakAction,
|
|
Tweak: HighlightTweak,
|
|
Value: true,
|
|
},
|
|
},
|
|
}
|
|
}
|