diff --git a/spec/unit/pushprocessor.spec.js b/spec/unit/pushprocessor.spec.js index 85fadcf78c1..df7666d5cd3 100644 --- a/spec/unit/pushprocessor.spec.js +++ b/spec/unit/pushprocessor.spec.js @@ -1,5 +1,6 @@ import * as utils from "../test-utils/test-utils"; import { PushProcessor } from "../../src/pushprocessor"; +import { EventType } from "../../src"; describe('NotificationService', function() { const testUserId = "@ali:matrix.org"; @@ -208,6 +209,7 @@ describe('NotificationService', function() { msgtype: "m.text", }, }); + matrixClient.pushRules = PushProcessor.rewriteDefaultRules(matrixClient.pushRules); pushProcessor = new PushProcessor(matrixClient); }); @@ -295,6 +297,21 @@ describe('NotificationService', function() { expect(actions.tweaks.highlight).toEqual(false); }); + it('should not bing on room server ACL changes', function() { + testEvent = utils.mkEvent({ + type: EventType.RoomServerAcl, + room: testRoomId, + user: "@alfred:localhost", + event: true, + content: {}, + }); + + const actions = pushProcessor.actionsForEvent(testEvent); + expect(actions.tweaks.highlight).toBeFalsy(); + expect(actions.tweaks.sound).toBeFalsy(); + expect(actions.notify).toBeFalsy(); + }); + // invalid it('should gracefully handle bad input.', function() { diff --git a/src/pushprocessor.ts b/src/pushprocessor.ts index ae170751f00..86462b4af43 100644 --- a/src/pushprocessor.ts +++ b/src/pushprocessor.ts @@ -34,6 +34,7 @@ import { PushRuleSet, TweakName, } from "./@types/PushRules"; +import { EventType } from "./@types/event"; /** * @module pushprocessor @@ -96,6 +97,22 @@ const DEFAULT_OVERRIDE_RULES: IPushRule[] = [ PushRuleActionName.DontNotify, ], }, + { + // For homeservers which don't support MSC3786 yet + rule_id: ".org.matrix.msc3786.rule.room.server_acl", + default: true, + enabled: true, + conditions: [ + { + kind: ConditionKind.EventMatch, + key: "type", + pattern: EventType.RoomServerAcl, + }, + ], + actions: [ + PushRuleActionName.DontNotify, + ], + }, ]; export interface IActionsObject {