UserInfo hide kick/mute buttons if they make no sense

pull/21833/head
Michael Telatynski 2019-12-23 18:20:59 +00:00
parent 6e9791c950
commit 0497ef228d
1 changed files with 6 additions and 0 deletions

View File

@ -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");