diff --git a/src/components/views/rooms/EventTile.tsx b/src/components/views/rooms/EventTile.tsx index a860d48ac9..d816c02769 100644 --- a/src/components/views/rooms/EventTile.tsx +++ b/src/components/views/rooms/EventTile.tsx @@ -360,6 +360,7 @@ interface IState { thread: Thread; threadReplyCount: number; threadLastReply: MatrixEvent; + threadLastSender: RoomMember | null; threadNotification?: NotificationCountType; } @@ -408,6 +409,7 @@ export default class EventTile extends React.Component { thread, threadReplyCount: thread?.length, threadLastReply: thread?.replyToEvent, + threadLastSender: thread?.replyToEvent.sender, }; // don't do RR animations until we are mounted @@ -562,6 +564,7 @@ export default class EventTile extends React.Component { this.setState({ threadLastReply: thread?.replyToEvent, + threadLastSender: thread?.replyToEvent?.sender, threadReplyCount: thread?.length, thread, }); @@ -659,23 +662,24 @@ export default class EventTile extends React.Component { private renderThreadLastMessagePreview(): JSX.Element | null { const { threadLastReply } = this.state; - if (!threadLastReply) { - return null; - } - const threadMessagePreview = MessagePreviewStore.instance.generatePreviewForEvent(threadLastReply); - if (!threadMessagePreview || !threadLastReply.sender) { - return null; - } - + const sender = this.thread.roomState.getSentinelMember(threadLastReply.getSender()); return <> - -
- - { threadMessagePreview } - -
+ + { threadMessagePreview && ( +
+ + { threadMessagePreview } + +
+ ) } ; }