Reuse PushProcessor from MatrixClient (#29561)
* Reuse PushProcessor from MatrixClient Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Reuse PushProcessor getPushRuleGlobRegex Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * delint Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update regex handling Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
committed by
GitHub
parent
3a39486468
commit
0d28df0f67
@@ -8,8 +8,6 @@ Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
// XXX: This feels wrong.
|
||||
import { PushProcessor } from "matrix-js-sdk/src/pushprocessor";
|
||||
import { PushRuleActionName } from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import SettingController from "./SettingController";
|
||||
@@ -20,8 +18,7 @@ import { type SettingLevel } from "../SettingLevel";
|
||||
// default action on this rule is dont_notify, but it could be something else
|
||||
export function isPushNotifyDisabled(): boolean {
|
||||
// Return the value of the master push rule as a default
|
||||
const processor = new PushProcessor(MatrixClientPeg.safeGet());
|
||||
const masterRule = processor.getPushRuleById(".m.rule.master");
|
||||
const masterRule = MatrixClientPeg.safeGet().pushProcessor.getPushRuleById(".m.rule.master");
|
||||
|
||||
if (!masterRule) {
|
||||
logger.warn("No master push rule! Notifications are disabled for this user.");
|
||||
|
||||
Reference in New Issue
Block a user