diff --git a/web/chat/message-preview.react.js b/web/chat/message-preview.react.js --- a/web/chat/message-preview.react.js +++ b/web/chat/message-preview.react.js @@ -22,7 +22,15 @@ +threadInfo: ThreadInfo, }; function MessagePreview(props: Props): React.Node { - if (!props.messageInfo) { + const { + messageInfo: originalMessageInfo, + threadInfo, + threadInfo: { + currentUser: { unread }, + }, + } = props; + + if (!originalMessageInfo) { return (
No messages @@ -30,20 +38,20 @@ ); } const messageInfo: ComposableMessageInfo | RobotextMessageInfo = - props.messageInfo.type === messageTypes.SIDEBAR_SOURCE - ? props.messageInfo.sourceMessage - : props.messageInfo; - const unread = props.threadInfo.currentUser.unread; + originalMessageInfo.type === messageTypes.SIDEBAR_SOURCE + ? originalMessageInfo.sourceMessage + : originalMessageInfo; + const messageTitle = getMessageTitle( messageInfo, - props.threadInfo, + threadInfo, getDefaultTextMessageRules().simpleMarkdownRules, ); if (messageInfo.type === messageTypes.TEXT) { let usernameText = null; if ( - threadIsGroupChat(props.threadInfo) || - props.threadInfo.name !== '' || + threadIsGroupChat(threadInfo) || + threadInfo.name !== '' || messageInfo.creator.isViewer ) { const userString = stringForUser(messageInfo.creator);