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

Commit 9bcb687

Browse files
authored
Merge pull request #5325 from matrix-org/t3chguy/fix/3434
Disable notifications for the room you have recently been active in
2 parents 5756256 + 7506e9a commit 9bcb687

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Notifier.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ import SettingsStore from "./settings/SettingsStore";
3434
import { hideToast as hideNotificationsToast } from "./toasts/DesktopNotificationsToast";
3535
import {SettingLevel} from "./settings/SettingLevel";
3636
import {isPushNotifyDisabled} from "./settings/controllers/NotificationControllers";
37+
import RoomViewStore from "./stores/RoomViewStore";
38+
import UserActivity from "./UserActivity";
3739

3840
/*
3941
* Dispatches:
@@ -376,6 +378,11 @@ export const Notifier = {
376378
const room = MatrixClientPeg.get().getRoom(ev.getRoomId());
377379
const actions = MatrixClientPeg.get().getPushActionsForEvent(ev);
378380
if (actions && actions.notify) {
381+
if (RoomViewStore.getRoomId() === room.roomId && UserActivity.sharedInstance().userActiveRecently()) {
382+
// don't bother notifying as user was recently active in this room
383+
return;
384+
}
385+
379386
if (this.isEnabled()) {
380387
this._displayPopupNotification(ev, room);
381388
}

0 commit comments

Comments
 (0)