1
0
mirror of https://github.com/element-hq/element-web.git synced 2025-11-29 21:23:11 +03:00

Disable redacting reactions if we don't have sufficient permissions (#8767)

This commit is contained in:
Šimon Brandner
2022-06-10 20:41:05 +02:00
committed by GitHub
parent 3f99f594de
commit 9b8b1d193e
11 changed files with 37 additions and 9 deletions

View File

@@ -169,6 +169,7 @@ export interface IRoomState {
searchInProgress?: boolean;
callState?: CallState;
canPeek: boolean;
canSelfRedact: boolean;
showApps: boolean;
isPeeking: boolean;
showRightPanel: boolean;
@@ -252,6 +253,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
searchResults: null,
callState: null,
canPeek: false,
canSelfRedact: false,
showApps: false,
isPeeking: false,
showRightPanel: false,
@@ -1173,10 +1175,14 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
private updatePermissions(room: Room) {
if (room) {
const me = this.context.getUserId();
const canReact = room.getMyMembership() === "join" && room.currentState.maySendEvent("m.reaction", me);
const canReact = (
room.getMyMembership() === "join" &&
room.currentState.maySendEvent(EventType.Reaction, me)
);
const canSendMessages = room.maySendMessage();
const canSelfRedact = room.currentState.maySendEvent(EventType.RoomRedaction, me);
this.setState({ canReact, canSendMessages });
this.setState({ canReact, canSendMessages, canSelfRedact });
}
}