Don't show Notifications Prompt Toast if user has master rule enabled
parent
c68a980c59
commit
493d3ae288
|
@ -33,6 +33,7 @@ import Modal from './Modal';
|
||||||
import SettingsStore from "./settings/SettingsStore";
|
import SettingsStore from "./settings/SettingsStore";
|
||||||
import { hideToast as hideNotificationsToast } from "./toasts/DesktopNotificationsToast";
|
import { hideToast as hideNotificationsToast } from "./toasts/DesktopNotificationsToast";
|
||||||
import {SettingLevel} from "./settings/SettingLevel";
|
import {SettingLevel} from "./settings/SettingLevel";
|
||||||
|
import {isPushNotifyDisabled} from "./settings/controllers/NotificationControllers";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dispatches:
|
* Dispatches:
|
||||||
|
@ -302,7 +303,7 @@ export const Notifier = {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const isGuest = client.isGuest();
|
const isGuest = client.isGuest();
|
||||||
return !isGuest && this.supportsDesktopNotifications() &&
|
return !isGuest && this.supportsDesktopNotifications() && !isPushNotifyDisabled() &&
|
||||||
!this.isEnabled() && !this._isToolbarHidden();
|
!this.isEnabled() && !this._isToolbarHidden();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ import {PushProcessor} from "matrix-js-sdk/src/pushprocessor";
|
||||||
|
|
||||||
// .m.rule.master being enabled means all events match that push rule
|
// .m.rule.master being enabled means all events match that push rule
|
||||||
// default action on this rule is dont_notify, but it could be something else
|
// default action on this rule is dont_notify, but it could be something else
|
||||||
function isPushNotifyDisabled(): boolean {
|
export function isPushNotifyDisabled(): boolean {
|
||||||
// Return the value of the master push rule as a default
|
// Return the value of the master push rule as a default
|
||||||
const processor = new PushProcessor(MatrixClientPeg.get());
|
const processor = new PushProcessor(MatrixClientPeg.get());
|
||||||
const masterRule = processor.getPushRuleById(".m.rule.master");
|
const masterRule = processor.getPushRuleById(".m.rule.master");
|
||||||
|
|
Loading…
Reference in New Issue