From 7e4d429fa3b7918a0f40fd9e3379ebb9074315a4 Mon Sep 17 00:00:00 2001
From: Michael Telatynski <7t3chguy@gmail.com>
Date: Thu, 17 Oct 2019 19:18:14 +0100
Subject: [PATCH] delint
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---
src/components/views/right_panel/UserInfo.js | 202 ++++++++++---------
1 file changed, 103 insertions(+), 99 deletions(-)
diff --git a/src/components/views/right_panel/UserInfo.js b/src/components/views/right_panel/UserInfo.js
index e5ac7d4665..3abe97dd75 100644
--- a/src/components/views/right_panel/UserInfo.js
+++ b/src/components/views/right_panel/UserInfo.js
@@ -532,114 +532,118 @@ const BanToggleButton = withLegacyMatrixClient(({matrixClient: cli, member, star
;
});
-const MuteToggleButton = withLegacyMatrixClient(({matrixClient: cli, member, room, powerLevels, startUpdating, stopUpdating}) => {
- const isMuted = _isMuted(member, powerLevels);
- const onMuteToggle = async () => {
- const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
- const roomId = member.roomId;
- const target = member.userId;
+const MuteToggleButton = withLegacyMatrixClient(
+ ({matrixClient: cli, member, room, powerLevels, startUpdating, stopUpdating}) => {
+ const isMuted = _isMuted(member, powerLevels);
+ const onMuteToggle = async () => {
+ const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
+ const roomId = member.roomId;
+ const target = member.userId;
- // if muting self, warn as it may be irreversible
- if (target === cli.getUserId()) {
- try {
- if (!(await _warnSelfDemote())) return;
- } catch (e) {
- console.error("Failed to warn about self demotion: ", e);
- return;
+ // if muting self, warn as it may be irreversible
+ if (target === cli.getUserId()) {
+ try {
+ if (!(await _warnSelfDemote())) return;
+ } catch (e) {
+ console.error("Failed to warn about self demotion: ", e);
+ return;
+ }
}
- }
- const powerLevelEvent = room.currentState.getStateEvents("m.room.power_levels", "");
- if (!powerLevelEvent) return;
+ const powerLevelEvent = room.currentState.getStateEvents("m.room.power_levels", "");
+ if (!powerLevelEvent) return;
- const powerLevels = powerLevelEvent.getContent();
- const levelToSend = (
- (powerLevels.events ? powerLevels.events["m.room.message"] : null) ||
- powerLevels.events_default
- );
- let level;
- if (isMuted) { // unmute
- level = levelToSend;
- } else { // mute
- level = levelToSend - 1;
- }
- level = parseInt(level);
+ const powerLevels = powerLevelEvent.getContent();
+ const levelToSend = (
+ (powerLevels.events ? powerLevels.events["m.room.message"] : null) ||
+ powerLevels.events_default
+ );
+ let level;
+ if (isMuted) { // unmute
+ level = levelToSend;
+ } else { // mute
+ level = levelToSend - 1;
+ }
+ level = parseInt(level);
- if (!isNaN(level)) {
- startUpdating();
- cli.setPowerLevel(roomId, target, level, powerLevelEvent).then(() => {
- // NO-OP; rely on the m.room.member event coming down else we could
- // get out of sync if we force setState here!
- console.log("Mute toggle success");
- }, function(err) {
- console.error("Mute error: " + err);
- Modal.createTrackedDialog('Failed to mute user', '', ErrorDialog, {
- title: _t("Error"),
- description: _t("Failed to mute user"),
+ if (!isNaN(level)) {
+ startUpdating();
+ cli.setPowerLevel(roomId, target, level, powerLevelEvent).then(() => {
+ // NO-OP; rely on the m.room.member event coming down else we could
+ // get out of sync if we force setState here!
+ console.log("Mute toggle success");
+ }, function(err) {
+ console.error("Mute error: " + err);
+ Modal.createTrackedDialog('Failed to mute user', '', ErrorDialog, {
+ title: _t("Error"),
+ description: _t("Failed to mute user"),
+ });
+ }).finally(() => {
+ stopUpdating();
});
- }).finally(() => {
- stopUpdating();
- });
+ }
+ };
+
+ const muteLabel = isMuted ? _t("Unmute") : _t("Mute");
+ return