0
0
Fork 0
mirror of https://github.com/matrix-org/dendrite synced 2024-12-14 14:03:55 +01:00
dendrite/internal/pushrules/default_content.go
Till 64472d9aab
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)
2022-09-09 13:56:33 +02:00

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,
},
},
}
}