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

Commit 91f2e4b

Browse files
authored
Merge pull request #5498 from menturion/develop
Call "MatrixClientPeg.get()" only once in method "findOverrideMuteRule"
2 parents 811ae9b + 56456b8 commit 91f2e4b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/RoomNotifs.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,13 @@ function setRoomNotifsStateUnmuted(roomId, newState) {
202202
}
203203

204204
function findOverrideMuteRule(roomId) {
205-
if (!MatrixClientPeg.get().pushRules ||
206-
!MatrixClientPeg.get().pushRules['global'] ||
207-
!MatrixClientPeg.get().pushRules['global'].override) {
205+
const cli = MatrixClientPeg.get();
206+
if (!cli.pushRules ||
207+
!cli.pushRules['global'] ||
208+
!cli.pushRules['global'].override) {
208209
return null;
209210
}
210-
for (const rule of MatrixClientPeg.get().pushRules['global'].override) {
211+
for (const rule of cli.pushRules['global'].override) {
211212
if (isRuleForRoom(roomId, rule)) {
212213
if (isMuteRule(rule) && rule.enabled) {
213214
return rule;

0 commit comments

Comments
 (0)