Page MenuHomePhabricator

D3506.id10631.diff
No OneTemporary

D3506.id10631.diff

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
@@ -25,6 +25,7 @@
const { messageInfo: messageInfoProps, threadInfo } = props;
const { unread } = threadInfo.currentUser;
+ let usernameText = null;
const colorStyle = unread ? css.white : css.light;
if (!messageInfoProps) {
@@ -44,30 +45,23 @@
threadInfo,
getDefaultTextMessageRules().simpleMarkdownRules,
);
- if (messageInfo.type === messageTypes.TEXT) {
- let usernameText = null;
- if (
- threadIsGroupChat(threadInfo) ||
- threadInfo.name !== '' ||
- messageInfo.creator.isViewer
- ) {
- const userString = stringForUser(messageInfo.creator);
- const username = `${userString}: `;
- usernameText = <span className={colorStyle}>{username}</span>;
- }
- return (
- <div className={classNames(css.lastMessage, colorStyle)}>
- {usernameText}
- {messageTitle}
- </div>
- );
- } else {
- return (
- <div className={classNames([css.lastMessage, colorStyle])}>
- {messageTitle}
- </div>
- );
+
+ const hasUsername =
+ threadIsGroupChat(threadInfo) ||
+ threadInfo.name !== '' ||
+ messageInfo.creator.isViewer;
+
+ if (messageInfo.type === messageTypes.TEXT && hasUsername) {
+ const userString = stringForUser(messageInfo.creator);
+ usernameText = <span className={colorStyle}>{`${userString}: `}</span>;
}
+
+ return (
+ <div className={classNames([css.lastMessage, colorStyle])}>
+ {usernameText}
+ {messageTitle}
+ </div>
+ );
}
export default MessagePreview;

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 22, 7:03 AM (35 m, 47 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2690518
Default Alt Text
D3506.id10631.diff (1 KB)

Event Timeline