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

Fix issues with ThreadSummary in msc-enabled mode #8018

Merged
merged 1 commit into from
Mar 10, 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
16 changes: 8 additions & 8 deletions src/components/views/rooms/ThreadSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@ const ThreadSummary = ({ mxEvent, thread }: IProps) => {

export const ThreadMessagePreview = ({ thread }: Pick<IProps, "thread">) => {
const cli = useContext(MatrixClientContext);
const lastReply = useTypedEventEmitterState(thread, ThreadEvent.Update, () => thread.lastReply());
const lastReply = useTypedEventEmitterState(thread, ThreadEvent.Update, () => thread.replyToEvent);
const preview = useAsyncMemo(async () => {
if (!lastReply) return;
await cli.decryptEventIfNeeded(lastReply);
return MessagePreviewStore.instance.generatePreviewForEvent(lastReply);
}, [lastReply]);
if (!preview) return null;

const sender = thread.roomState.getSentinelMember(lastReply.getSender());
return <>
Expand All @@ -83,13 +85,11 @@ export const ThreadMessagePreview = ({ thread }: Pick<IProps, "thread">) => {
height={24}
className="mx_ThreadInfo_avatar"
/>
{ preview && (
<div className="mx_ThreadInfo_content">
<span className="mx_ThreadInfo_message-preview">
{ preview }
</span>
</div>
) }
<div className="mx_ThreadInfo_content">
<span className="mx_ThreadInfo_message-preview">
{ preview }
</span>
</div>
</>;
};

Expand Down