This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ import SettingsStore from '../../../settings/SettingsStore';
3131import { isUrlPermitted } from '../../../HtmlUtils' ;
3232import { isContentActionable } from '../../../utils/EventUtils' ;
3333import { MenuItem } from "../../structures/ContextMenu" ;
34+ import { EventType } from "matrix-js-sdk/src/@types/event" ;
3435
3536function canCancel ( eventStatus ) {
3637 return eventStatus === EventStatus . QUEUED || eventStatus === EventStatus . NOT_SENT ;
@@ -72,7 +73,10 @@ export default class MessageContextMenu extends React.Component {
7273 const cli = MatrixClientPeg . get ( ) ;
7374 const room = cli . getRoom ( this . props . mxEvent . getRoomId ( ) ) ;
7475
75- const canRedact = room . currentState . maySendRedactionForEvent ( this . props . mxEvent , cli . credentials . userId ) ;
76+ // We explicitly decline to show the redact option on ACL events as it has a potential
77+ // to obliterate the room - https://github.com/matrix-org/synapse/issues/4042
78+ const canRedact = room . currentState . maySendRedactionForEvent ( this . props . mxEvent , cli . credentials . userId )
79+ && this . props . mxEvent . getType ( ) !== EventType . RoomServerAcl ;
7680 let canPin = room . currentState . mayClientSendStateEvent ( 'm.room.pinned_events' , cli ) ;
7781
7882 // HACK: Intentionally say we can't pin if the user doesn't want to use the functionality
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ import ErrorDialog from "../dialogs/ErrorDialog";
6060import QuestionDialog from "../dialogs/QuestionDialog" ;
6161import ConfirmUserActionDialog from "../dialogs/ConfirmUserActionDialog" ;
6262import InfoDialog from "../dialogs/InfoDialog" ;
63+ import { EventType } from "matrix-js-sdk/src/@types/event" ;
6364
6465interface IDevice {
6566 deviceId : string ;
@@ -586,7 +587,10 @@ const RedactMessagesButton: React.FC<IBaseProps> = ({member}) => {
586587 while ( timeline ) {
587588 eventsToRedact = timeline . getEvents ( ) . reduce ( ( events , event ) => {
588589 if ( event . getSender ( ) === userId && ! event . isRedacted ( ) && ! event . isRedaction ( ) &&
589- event . getType ( ) !== "m.room.create"
590+ event . getType ( ) !== EventType . RoomCreate &&
591+ // Don't redact ACLs because that'll obliterate the room
592+ // See https://github.com/matrix-org/synapse/issues/4042 for details.
593+ event . getType ( ) !== EventType . RoomServerAcl
590594 ) {
591595 return events . concat ( event ) ;
592596 } else {
You can’t perform that action at this time.
0 commit comments