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.
This commit is contained in:
Till 2022-12-23 12:52:47 +01:00 committed by GitHub
parent 5eed31fea3
commit f47515e38b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 210 additions and 110 deletions

View file

@ -25,7 +25,7 @@ var (
{
Kind: EventMatchCondition,
Key: "type",
Pattern: "m.call.invite",
Pattern: pointer("m.call.invite"),
},
},
Actions: []*Action{
@ -35,11 +35,6 @@ var (
Tweak: SoundTweak,
Value: "ring",
},
{
Kind: SetTweakAction,
Tweak: HighlightTweak,
Value: false,
},
},
}
mRuleEncryptedRoomOneToOneDefinition = Rule{
@ -54,7 +49,7 @@ var (
{
Kind: EventMatchCondition,
Key: "type",
Pattern: "m.room.encrypted",
Pattern: pointer("m.room.encrypted"),
},
},
Actions: []*Action{
@ -64,11 +59,6 @@ var (
Tweak: SoundTweak,
Value: "default",
},
{
Kind: SetTweakAction,
Tweak: HighlightTweak,
Value: false,
},
},
}
mRuleRoomOneToOneDefinition = Rule{
@ -83,20 +73,15 @@ var (
{
Kind: EventMatchCondition,
Key: "type",
Pattern: "m.room.message",
Pattern: pointer("m.room.message"),
},
},
Actions: []*Action{
{Kind: NotifyAction},
{
Kind: SetTweakAction,
Tweak: HighlightTweak,
Value: false,
},
{
Kind: SetTweakAction,
Tweak: HighlightTweak,
Value: false,
Tweak: SoundTweak,
Value: "default",
},
},
}
@ -108,16 +93,11 @@ var (
{
Kind: EventMatchCondition,
Key: "type",
Pattern: "m.room.message",
Pattern: pointer("m.room.message"),
},
},
Actions: []*Action{
{Kind: NotifyAction},
{
Kind: SetTweakAction,
Tweak: HighlightTweak,
Value: false,
},
},
}
mRuleEncryptedDefinition = Rule{
@ -128,16 +108,11 @@ var (
{
Kind: EventMatchCondition,
Key: "type",
Pattern: "m.room.encrypted",
Pattern: pointer("m.room.encrypted"),
},
},
Actions: []*Action{
{Kind: NotifyAction},
{
Kind: SetTweakAction,
Tweak: HighlightTweak,
Value: false,
},
},
}
)