diff --git a/src/RoomNotifs.ts b/src/RoomNotifs.ts index 5abee9a6ad..50d75ea91e 100644 --- a/src/RoomNotifs.ts +++ b/src/RoomNotifs.ts @@ -18,7 +18,7 @@ limitations under the License. import { MatrixClientPeg } from './MatrixClientPeg'; import { PushProcessor } from 'matrix-js-sdk/src/pushprocessor'; import { NotificationCountType, Room } from "matrix-js-sdk/src/models/room"; -import { IAnnotatedPushRule, PushRuleKind } from "matrix-js-sdk/src/@types/PushRules"; +import { ConditionKind, IPushRule, PushRuleActionName, PushRuleKind } from "matrix-js-sdk/src/@types/PushRules"; export enum RoomNotifState { AllMessagesLoud = 'all_messages_loud', @@ -205,14 +205,12 @@ function setRoomNotifsStateUnmuted(roomId: string, newState: RoomNotifState): Pr return Promise.all(promises); } -function findOverrideMuteRule(roomId: string): IAnnotatedPushRule { +function findOverrideMuteRule(roomId: string): IPushRule { const cli = MatrixClientPeg.get(); - if (!cli.pushRules || - !cli.pushRules['global'] || - !cli.pushRules['global'].override) { + if (!cli?.pushRules?.global?.override) { return null; } - for (const rule of cli.pushRules['global'].override) { + for (const rule of cli.pushRules.global.override) { if (isRuleForRoom(roomId, rule)) { if (isMuteRule(rule) && rule.enabled) { return rule; @@ -222,14 +220,14 @@ function findOverrideMuteRule(roomId: string): IAnnotatedPushRule { return null; } -function isRuleForRoom(roomId: string, rule: IAnnotatedPushRule): boolean { +function isRuleForRoom(roomId: string, rule: IPushRule): boolean { if (rule.conditions.length !== 1) { return false; } const cond = rule.conditions[0]; - return (cond.kind === 'event_match' && cond.key === 'room_id' && cond.pattern === roomId); + return (cond.kind === ConditionKind.EventMatch && cond.key === 'room_id' && cond.pattern === roomId); } -function isMuteRule(rule: IAnnotatedPushRule): boolean { - return (rule.actions.length === 1 && rule.actions[0] === 'dont_notify'); +function isMuteRule(rule: IPushRule): boolean { + return (rule.actions.length === 1 && rule.actions[0] === PushRuleActionName.DontNotify); } diff --git a/src/components/views/dialogs/IncomingSasDialog.tsx b/src/components/views/dialogs/IncomingSasDialog.tsx index da766f495c..9b372c2b38 100644 --- a/src/components/views/dialogs/IncomingSasDialog.tsx +++ b/src/components/views/dialogs/IncomingSasDialog.tsx @@ -39,7 +39,7 @@ const PHASE_VERIFIED = 3; const PHASE_CANCELLED = 4; interface IProps extends IDialogProps { - verifier: VerificationBase; // TODO types + verifier: VerificationBase; } interface IState {