From 0497ef228d7348d8b82a72832e23fdbc1de5119f Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 23 Dec 2019 18:20:59 +0000 Subject: [PATCH] UserInfo hide kick/mute buttons if they make no sense --- src/components/views/right_panel/UserInfo.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/views/right_panel/UserInfo.js b/src/components/views/right_panel/UserInfo.js index 4dd71700ad..316c8d3d0e 100644 --- a/src/components/views/right_panel/UserInfo.js +++ b/src/components/views/right_panel/UserInfo.js @@ -425,6 +425,9 @@ const useRoomPowerLevels = (cli, room) => { const RoomKickButton = ({member, startUpdating, stopUpdating}) => { const cli = useContext(MatrixClientContext); + // check if user can be kicked/disinvited + if (member.membership !== "invite" && member.membership !== "join") return null; + const onKick = async () => { const ConfirmUserActionDialog = sdk.getComponent("dialogs.ConfirmUserActionDialog"); const {finished} = Modal.createTrackedDialog( @@ -602,6 +605,9 @@ const BanToggleButton = ({member, startUpdating, stopUpdating}) => { const MuteToggleButton = ({member, room, powerLevels, startUpdating, stopUpdating}) => { const cli = useContext(MatrixClientContext); + // Don't show the mute/unmute option if the user is not in the room + if (member.membership !== "join") return null; + const isMuted = _isMuted(member, powerLevels); const onMuteToggle = async () => { const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");