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:
Michael Telatynski 2019-12-23 18:33:05 +00:00 committed by GitHub
commit 23b9b98f7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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