dendrite/internal/pushrules/default_content.go
Till f47515e38b
Pushrule tweaks, make pattern non-optional on EventMatchCondition (#2918)
This should fix https://github.com/matrix-org/dendrite/issues/2882
(Tested with FluffyChat 1.7.1)
Also adds tests that the predefined push rules (as per the spec) is what
we have in Dendrite.
2022-12-23 12:52:47 +01:00

33 lines
580 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,
Actions: []*Action{
{Kind: NotifyAction},
{
Kind: SetTweakAction,
Tweak: SoundTweak,
Value: "default",
},
{
Kind: SetTweakAction,
Tweak: HighlightTweak,
},
},
}
}