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

Commit

Permalink
Handle UTD in pinning message banner
Browse files Browse the repository at this point in the history
  • Loading branch information
florianduros committed Aug 26, 2024
1 parent ce6fb65 commit 0e3c560
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/components/views/rooms/PinnedMessageBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function PinnedMessageBanner({ room, permalinkCreator }: PinnedMessageBan
const pinnedEvent = pinnedEvents[currentEventIndex];
// Generate a preview for the pinned event
const eventPreview = useMemo(() => {
if (!pinnedEvent || pinnedEvent.isRedacted()) return null;
if (!pinnedEvent || pinnedEvent.isRedacted() || pinnedEvent.isDecryptionFailure()) return null;
return MessagePreviewStore.instance.generatePreviewForEvent(pinnedEvent);
}, [pinnedEvent]);

Expand Down Expand Up @@ -114,16 +114,17 @@ export function PinnedMessageBanner({ room, permalinkCreator }: PinnedMessageBan
)}
{eventPreview && <span className="mx_PinnedMessageBanner_message">{eventPreview}</span>}
{/* In case of redacted event, we want to display the nice sentence of the message event like in the timeline or in the pinned message list */}
{pinnedEvent.isRedacted() && (
<div className="mx_PinnedMessageBanner_redactedMessage">
<MessageEvent
mxEvent={pinnedEvent}
maxImageHeight={20}
permalinkCreator={permalinkCreator}
replacingEventId={pinnedEvent.replacingEventId()}
/>
</div>
)}
{pinnedEvent.isRedacted() ||
(pinnedEvent.isDecryptionFailure() && (
<div className="mx_PinnedMessageBanner_redactedMessage">
<MessageEvent
mxEvent={pinnedEvent}
maxImageHeight={20}
permalinkCreator={permalinkCreator}
replacingEventId={pinnedEvent.replacingEventId()}
/>
</div>
))}
</button>
{!isSinglePinnedEvent && <BannerButton room={room} />}
</div>
Expand Down

0 comments on commit 0e3c560

Please sign in to comment.