You've already forked element-web
mirror of
https://github.com/element-hq/element-web.git
synced 2025-11-29 21:23:11 +03:00
Hide composer and call buttons when the room is tombstoned (#7975)
This commit is contained in:
committed by
GitHub
parent
675b4271e9
commit
0e60ad98c1
@@ -187,7 +187,8 @@ export interface IRoomState {
|
||||
|
||||
upgradeRecommendation?: IRecommendedVersion;
|
||||
canReact: boolean;
|
||||
canReply: boolean;
|
||||
canSendMessages: boolean;
|
||||
tombstone?: MatrixEvent;
|
||||
layout: Layout;
|
||||
lowBandwidth: boolean;
|
||||
alwaysShowTimestamps: boolean;
|
||||
@@ -259,7 +260,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
||||
showTopUnreadMessagesBar: false,
|
||||
statusBarVisible: false,
|
||||
canReact: false,
|
||||
canReply: false,
|
||||
canSendMessages: false,
|
||||
layout: SettingsStore.getValue("layout"),
|
||||
lowBandwidth: SettingsStore.getValue("lowBandwidth"),
|
||||
alwaysShowTimestamps: SettingsStore.getValue("alwaysShowTimestamps"),
|
||||
@@ -371,12 +372,6 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
||||
: MainSplitContentType.Timeline;
|
||||
};
|
||||
|
||||
private onReadReceiptsChange = () => {
|
||||
this.setState({
|
||||
showReadReceipts: SettingsStore.getValue("showReadReceipts", this.state.roomId),
|
||||
});
|
||||
};
|
||||
|
||||
private onRoomViewStoreUpdate = async (initial?: boolean): Promise<void> => {
|
||||
if (this.unmounted) {
|
||||
return;
|
||||
@@ -1033,10 +1028,15 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
||||
this.checkWidgets(room);
|
||||
|
||||
this.setState({
|
||||
tombstone: this.getRoomTombstone(),
|
||||
liveTimeline: room.getLiveTimeline(),
|
||||
});
|
||||
};
|
||||
|
||||
private getRoomTombstone() {
|
||||
return this.state.room?.currentState.getStateEvents(EventType.RoomTombstone, "");
|
||||
}
|
||||
|
||||
private async calculateRecommendedVersion(room: Room) {
|
||||
const upgradeRecommendation = await room.getRecommendedVersion();
|
||||
if (this.unmounted) return;
|
||||
@@ -1167,17 +1167,23 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
||||
// ignore if we don't have a room yet
|
||||
if (!this.state.room || this.state.room.roomId !== state.roomId) return;
|
||||
|
||||
if (ev.getType() === EventType.RoomCanonicalAlias) {
|
||||
// re-view the room so MatrixChat can manage the alias in the URL properly
|
||||
dis.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: this.state.room.roomId,
|
||||
metricsTrigger: undefined, // room doesn't change
|
||||
});
|
||||
return; // this event cannot affect permissions so bail
|
||||
}
|
||||
switch (ev.getType()) {
|
||||
case EventType.RoomCanonicalAlias:
|
||||
// re-view the room so MatrixChat can manage the alias in the URL properly
|
||||
dis.dispatch<ViewRoomPayload>({
|
||||
action: Action.ViewRoom,
|
||||
room_id: this.state.room.roomId,
|
||||
metricsTrigger: undefined, // room doesn't change
|
||||
});
|
||||
break;
|
||||
|
||||
this.updatePermissions(this.state.room);
|
||||
case EventType.RoomTombstone:
|
||||
this.setState({ tombstone: this.getRoomTombstone() });
|
||||
break;
|
||||
|
||||
default:
|
||||
this.updatePermissions(this.state.room);
|
||||
}
|
||||
};
|
||||
|
||||
private onRoomStateUpdate = (state: RoomState) => {
|
||||
@@ -1201,9 +1207,9 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
||||
if (room) {
|
||||
const me = this.context.getUserId();
|
||||
const canReact = room.getMyMembership() === "join" && room.currentState.maySendEvent("m.reaction", me);
|
||||
const canReply = room.maySendMessage();
|
||||
const canSendMessages = room.maySendMessage();
|
||||
|
||||
this.setState({ canReact, canReply });
|
||||
this.setState({ canReact, canSendMessages });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user