Merge pull request #5498 from menturion/develop

Call "MatrixClientPeg.get()" only once in method "findOverrideMuteRule"
This commit is contained in:
J. Ryan Stinnett 2021-02-08 13:41:16 +00:00 committed by GitHub
commit 91f2e4b5db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -202,12 +202,13 @@ function setRoomNotifsStateUnmuted(roomId, newState) {
} }
function findOverrideMuteRule(roomId) { function findOverrideMuteRule(roomId) {
if (!MatrixClientPeg.get().pushRules || const cli = MatrixClientPeg.get();
!MatrixClientPeg.get().pushRules['global'] || if (!cli.pushRules ||
!MatrixClientPeg.get().pushRules['global'].override) { !cli.pushRules['global'] ||
!cli.pushRules['global'].override) {
return null; return null;
} }
for (const rule of MatrixClientPeg.get().pushRules['global'].override) { for (const rule of cli.pushRules['global'].override) {
if (isRuleForRoom(roomId, rule)) { if (isRuleForRoom(roomId, rule)) {
if (isMuteRule(rule) && rule.enabled) { if (isMuteRule(rule) && rule.enabled) {
return rule; return rule;