mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-15 20:54:59 +08:00
Move stuff out of if statement for better readability
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
a18f41ceed
commit
79e4a95b13
@ -481,15 +481,14 @@ export default class CallHandler extends EventEmitter {
|
||||
const incomingCallPushRule = (
|
||||
new PushProcessor(MatrixClientPeg.get()).getPushRuleById(RuleId.IncomingCall) as IPushRule
|
||||
);
|
||||
const pushRuleEnabled = incomingCallPushRule?.enabled;
|
||||
const tweakSetToRing = incomingCallPushRule.actions.some((action: Tweaks) => (
|
||||
action.set_tweak === TweakName.Sound &&
|
||||
action.value === "ring"
|
||||
));
|
||||
switch (newState) {
|
||||
case CallState.Ringing:
|
||||
if (
|
||||
incomingCallPushRule?.enabled &&
|
||||
incomingCallPushRule.actions.some((a: Tweaks) => (
|
||||
a.set_tweak === TweakName.Sound &&
|
||||
a.value === "ring"
|
||||
))
|
||||
) {
|
||||
if (pushRuleEnabled && tweakSetToRing) {
|
||||
this.play(AudioID.Ring);
|
||||
} else {
|
||||
this.silenceCall(call.callId);
|
||||
|
Loading…
Reference in New Issue
Block a user