Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

GYU: Fix issues with audible keywords without activated mentions #11218

Merged
merged 1 commit into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export function toNotificationSettings(
supportsIntentionalMentions && standardRules.get(RuleId.IsUserMention),
standardRules.get(RuleId.ContainsUserName),
standardRules.get(RuleId.ContainsDisplayName),
...contentRules,
]),
people: determineSound(dmRules),
},
Expand Down
33 changes: 33 additions & 0 deletions test/models/notificationsettings/NotificationSettings-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,37 @@ describe("NotificationSettings", () => {
expect(pendingChanges.deleted).toHaveLength(0);
expect(pendingChanges.updated).toHaveLength(0);
});

it("correctly handles audible keywords without mentions settings", async () => {
const pushRules = (await import("./pushrules_bug_keyword_only.json")) as IPushRules;
const model = toNotificationSettings(pushRules, false);
const pendingChanges = reconcileNotificationSettings(pushRules, model, false);
const expectedModel: NotificationSettings = {
globalMute: false,
defaultLevels: {
dm: RoomNotifState.MentionsOnly,
room: RoomNotifState.MentionsOnly,
},
sound: {
calls: "ring",
mentions: "default",
people: undefined,
},
activity: {
bot_notices: true,
invite: true,
status_event: false,
},
mentions: {
user: false,
room: true,
keywords: true,
},
keywords: ["janne"],
};
expect(model).toEqual(expectedModel);
expect(pendingChanges.added).toHaveLength(0);
expect(pendingChanges.deleted).toHaveLength(0);
expect(pendingChanges.updated).toHaveLength(0);
});
});
Loading