Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3525988
D3506.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D3506.diff
View Options
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
@@ -48,30 +48,24 @@
threadInfo,
getDefaultTextMessageRules().simpleMarkdownRules,
);
- if (messageInfo.type === messageTypes.TEXT) {
- let usernameText = null;
- if (
- threadIsGroupChat(threadInfo) ||
+
+ let usernameText = null;
+ if (
+ messageInfo.type === messageTypes.TEXT &&
+ (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>
- );
+ messageInfo.creator.isViewer)
+ ) {
+ 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
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 24, 7:04 PM (8 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2700848
Default Alt Text
D3506.diff (1 KB)
Attached To
Mode
D3506: [web] [refactor] simplify username logic in message preview
Attached
Detach File
Event Timeline
Log In to Comment