Skip to content

Commit b179f55

Browse files
authored
GYU: Fix issues with audible keywords without activated mentions (matrix-org#11218)
1 parent d014756 commit b179f55

File tree

3 files changed

+411
-0
lines changed

3 files changed

+411
-0
lines changed

src/models/notificationsettings/toNotificationSettings.ts

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export function toNotificationSettings(
8686
supportsIntentionalMentions && standardRules.get(RuleId.IsUserMention),
8787
standardRules.get(RuleId.ContainsUserName),
8888
standardRules.get(RuleId.ContainsDisplayName),
89+
...contentRules,
8990
]),
9091
people: determineSound(dmRules),
9192
},

test/models/notificationsettings/NotificationSettings-test.ts

+33
Original file line numberDiff line numberDiff line change
@@ -190,4 +190,37 @@ describe("NotificationSettings", () => {
190190
expect(pendingChanges.deleted).toHaveLength(0);
191191
expect(pendingChanges.updated).toHaveLength(0);
192192
});
193+
194+
it("correctly handles audible keywords without mentions settings", async () => {
195+
const pushRules = (await import("./pushrules_bug_keyword_only.json")) as IPushRules;
196+
const model = toNotificationSettings(pushRules, false);
197+
const pendingChanges = reconcileNotificationSettings(pushRules, model, false);
198+
const expectedModel: NotificationSettings = {
199+
globalMute: false,
200+
defaultLevels: {
201+
dm: RoomNotifState.MentionsOnly,
202+
room: RoomNotifState.MentionsOnly,
203+
},
204+
sound: {
205+
calls: "ring",
206+
mentions: "default",
207+
people: undefined,
208+
},
209+
activity: {
210+
bot_notices: true,
211+
invite: true,
212+
status_event: false,
213+
},
214+
mentions: {
215+
user: false,
216+
room: true,
217+
keywords: true,
218+
},
219+
keywords: ["janne"],
220+
};
221+
expect(model).toEqual(expectedModel);
222+
expect(pendingChanges.added).toHaveLength(0);
223+
expect(pendingChanges.deleted).toHaveLength(0);
224+
expect(pendingChanges.updated).toHaveLength(0);
225+
});
193226
});

0 commit comments

Comments
 (0)