aboutsummaryrefslogtreecommitdiff
path: root/matrix/pushrules
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2019-04-27 15:02:21 +0300
committerTulir Asokan <tulir@maunium.net>2019-04-27 15:02:21 +0300
commitbc7e2d9a1c871e3fbce932f9695fc24083bc2cc4 (patch)
tree89f104f59ee6aa33ea41140c8472ff5ba95f97a9 /matrix/pushrules
parent60e3fe392711ef233aa68a062a7ee96d145d2cb4 (diff)
Add locks and other sync stuff
Diffstat (limited to 'matrix/pushrules')
-rw-r--r--matrix/pushrules/ruleset.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/matrix/pushrules/ruleset.go b/matrix/pushrules/ruleset.go
index 33036c4..7ad931a 100644
--- a/matrix/pushrules/ruleset.go
+++ b/matrix/pushrules/ruleset.go
@@ -75,7 +75,7 @@ func (rs *PushRuleset) MarshalJSON() ([]byte, error) {
// DefaultPushActions is the value returned if none of the rule
// collections in a Ruleset match the event given to GetActions()
-var DefaultPushActions = make(PushActionArray, 0)
+var DefaultPushActions = PushActionArray{&PushAction{Action: ActionDontNotify}}
// GetActions matches the given event against all of the push rule
// collections in this push ruleset in the order of priority as
@@ -85,6 +85,9 @@ func (rs *PushRuleset) GetActions(room Room, event *mautrix.Event) (match PushAc
arrays := []PushRuleCollection{rs.Override, rs.Content, rs.Room, rs.Sender, rs.Underride}
// Loop until one of the push rule collections matches the room/event combo.
for _, pra := range arrays {
+ if pra == nil {
+ continue
+ }
if match = pra.GetActions(room, event); match != nil {
// Match found, return it.
return