diff --git a/src/components/views/rooms/MemberList.tsx b/src/components/views/rooms/MemberList.tsx index bcc4c4fb97..d064bdfe3d 100644 --- a/src/components/views/rooms/MemberList.tsx +++ b/src/components/views/rooms/MemberList.tsx @@ -46,6 +46,7 @@ import { shouldShowComponent } from "../../../customisations/helpers/UIComponent import { UIComponent } from "../../../settings/UIFeature"; import PosthogTrackers from "../../../PosthogTrackers"; import { SDKContext } from "../../../contexts/SDKContext"; +import AccessibleTooltipButton from "../elements/AccessibleTooltipButton"; const INITIAL_LOAD_NUM_MEMBERS = 30; const INITIAL_LOAD_NUM_INVITED = 5; @@ -349,7 +350,7 @@ export default class MemberList extends React.Component { const cli = MatrixClientPeg.get(); const room = cli.getRoom(this.props.roomId); - let inviteButton; + let inviteButton: JSX.Element | undefined; if (room?.getMyMembership() === "join" && shouldShowComponent(UIComponent.InviteUsers)) { let inviteButtonText = _t("Invite to this room"); @@ -357,15 +358,24 @@ export default class MemberList extends React.Component { inviteButtonText = _t("Invite to this space"); } - inviteButton = ( - - {inviteButtonText} - - ); + if (this.state.canInvite) { + inviteButton = ( + + {inviteButtonText} + + ); + } else { + inviteButton = ( + + {inviteButtonText} + + ); + } } let invitedHeader; diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 3847915e76..b2485b4169 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1947,6 +1947,7 @@ "and %(count)s others...|one": "and one other...", "Invite to this room": "Invite to this room", "Invite to this space": "Invite to this space", + "You do not have permission to invite users": "You do not have permission to invite users", "Invited": "Invited", "Filter room members": "Filter room members", "%(userName)s (power %(powerLevelNumber)s)": "%(userName)s (power %(powerLevelNumber)s)",