Update src/components/views/rooms/RoomTile.tsx

This commit is contained in:
Jaiwanth 2021-03-19 22:46:19 +05:30
parent 70e0b77fc4
commit 495cbadb08

View file

@ -464,16 +464,8 @@ export default class RoomTile extends React.PureComponent<IProps, IState> {
const isLowPriority = roomTags.includes(DefaultTagID.LowPriority); const isLowPriority = roomTags.includes(DefaultTagID.LowPriority);
const lowPriorityLabel = _t("Low Priority"); const lowPriorityLabel = _t("Low Priority");
const inRoom = this.props.room.getMyMembership() === "join";
const userId = MatrixClientPeg.get().getUserId(); const userId = MatrixClientPeg.get().getUserId();
let canInvite = inRoom; const canInvite = this.props.room.canInvite(userId);
const powerLevels = this.props.room.currentState
.getStateEvents("m.room.power_levels", "")
?.getContent();
const me = this.props.room.getMember(userId);
if (powerLevels && me && powerLevels.invite > me.powerLevel) {
canInvite = false;
}
contextMenu = <IconizedContextMenu contextMenu = <IconizedContextMenu
{...contextMenuBelow(this.state.generalMenuPosition)} {...contextMenuBelow(this.state.generalMenuPosition)}
onFinished={this.onCloseGeneralMenu} onFinished={this.onCloseGeneralMenu}