Merge pull request #3774 from matrix-org/t3chguy/userinfo_tweaks
UserInfo hide kick/mute buttons if they make no sense
This commit is contained in:
commit
23b9b98f7b
1 changed files with 6 additions and 0 deletions
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue