Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Don't show shield next to deleted messages #7671

Merged
merged 2 commits into from
Jan 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/components/views/rooms/EventTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ export function getHandlerTile(ev: MatrixEvent): string {
return stateEventTileTypes[type];
}

if (ev.isRedacted()) {
return "messages.MessageEvent";
}

return eventTileTypes[type];
}

Expand Down Expand Up @@ -762,7 +766,7 @@ export default class EventTile extends React.Component<IProps, IState> {
};

private async verifyEvent(mxEvent: MatrixEvent): Promise<void> {
if (!mxEvent.isEncrypted()) {
if (!mxEvent.isEncrypted() || mxEvent.isRedacted()) {
return;
}

Expand Down Expand Up @@ -1020,8 +1024,8 @@ export default class EventTile extends React.Component<IProps, IState> {
return <E2ePadlockUndecryptable />;
}

// event is encrypted, display padlock corresponding to whether or not it is verified
if (ev.isEncrypted()) {
// event is encrypted and not redacted, display padlock corresponding to whether or not it is verified
if (ev.isEncrypted() && !ev.isRedacted()) {
if (this.state.verified === E2EState.Normal) {
return; // no icon if we've not even cross-signed the user
} else if (this.state.verified === E2EState.Verified) {
Expand All @@ -1047,6 +1051,9 @@ export default class EventTile extends React.Component<IProps, IState> {
if (ev.isState()) {
return; // we expect this to be unencrypted
}
if (ev.isRedacted()) {
return; // we expect this to be unencrypted
}
// if the event is not encrypted, but it's an e2e room, show the open padlock
return <E2ePadlockUnencrypted />;
}
Expand Down Expand Up @@ -1611,8 +1618,8 @@ function isMessageEvent(ev: MatrixEvent): boolean {
}

export function haveTileForEvent(e: MatrixEvent, showHiddenEvents?: boolean): boolean {
// Only messages have a tile (black-rectangle) if redacted
if (e.isRedacted() && !isMessageEvent(e)) return false;
// Only show "Message deleted" tile for message or encrypted events
if (e.isRedacted() && !e.isEncrypted() && !isMessageEvent(e)) return false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand the need for this change, why would only encrypted events show that they were redacted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, we showed the Message removed tile only for m.room.message events. But if an event is encrypted we can't tell if it's an m.room.message event, so we always show the tile for encrypted events

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah fun


// No tile for replacement events since they update the original tile
if (e.isRelation("m.replace")) return false;
Expand Down