Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3394327
D5886.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D5886.diff
View Options
diff --git a/lib/shared/message-utils.js b/lib/shared/message-utils.js
--- a/lib/shared/message-utils.js
+++ b/lib/shared/message-utils.js
@@ -4,7 +4,6 @@
import _maxBy from 'lodash/fp/maxBy';
import _orderBy from 'lodash/fp/orderBy';
-import { multimediaMessagePreview } from '../media/media-utils';
import { userIDsToRelativeUserInfos } from '../selectors/user-selectors';
import type { PlatformDetails } from '../types/device-types';
import type { Media } from '../types/media-types';
@@ -13,7 +12,6 @@
type RawMessageInfo,
type ReactionMessageInfo,
type RobotextMessageInfo,
- type PreviewableMessageInfo,
type RawMultimediaMessageInfo,
type MessageData,
type MessageType,
@@ -290,29 +288,6 @@
});
}
-function reactionMessagePreview(): string {
- return 'liked a message';
-}
-
-function messagePreviewText(
- messageInfo: PreviewableMessageInfo,
- threadInfo: ThreadInfo,
-): string {
- if (
- messageInfo.type === messageTypes.IMAGES ||
- messageInfo.type === messageTypes.MULTIMEDIA ||
- messageInfo.type === messageTypes.REACTION
- ) {
- const creator = stringForUser(messageInfo.creator);
- const preview =
- messageInfo.type === messageTypes.REACTION
- ? reactionMessagePreview()
- : multimediaMessagePreview(messageInfo);
- return `${creator} ${preview}`;
- }
- return robotextToRawString(robotextForMessageInfo(messageInfo, threadInfo));
-}
-
type MediaMessageDataCreationInput = $ReadOnly<{
threadID: string,
creatorID: string,
@@ -569,7 +544,6 @@
usersInMessageInfos,
combineTruncationStatuses,
shimUnsupportedRawMessageInfos,
- messagePreviewText,
createMediaMessageData,
createMediaMessageInfo,
stripLocalIDs,
diff --git a/lib/shared/messages/multimedia-message-spec.js b/lib/shared/messages/multimedia-message-spec.js
--- a/lib/shared/messages/multimedia-message-spec.js
+++ b/lib/shared/messages/multimedia-message-spec.js
@@ -42,7 +42,6 @@
} from '../../utils/message-ops-utils';
import {
createMediaMessageInfo,
- messagePreviewText,
removeCreatorAsViewer,
} from '../message-utils';
import { threadIsGroupChat } from '../thread-utils';
@@ -128,14 +127,15 @@
messageTitle({
messageInfo,
- threadInfo,
viewerContext,
}: MessageTitleParam<MediaMessageInfo | ImagesMessageInfo>) {
let validMessageInfo: MultimediaMessageInfo = (messageInfo: MultimediaMessageInfo);
if (viewerContext === 'global_viewer') {
validMessageInfo = removeCreatorAsViewer(validMessageInfo);
}
- return messagePreviewText(validMessageInfo, threadInfo);
+ const creator = stringForUser(validMessageInfo.creator);
+ const preview = multimediaMessagePreview(validMessageInfo);
+ return `${creator} ${preview}`;
},
rawMessageInfoFromServerDBRow(
diff --git a/lib/shared/messages/reaction-message-spec.js b/lib/shared/messages/reaction-message-spec.js
--- a/lib/shared/messages/reaction-message-spec.js
+++ b/lib/shared/messages/reaction-message-spec.js
@@ -16,7 +16,7 @@
import type { NotifTexts } from '../../types/notif-types';
import type { ThreadInfo } from '../../types/thread-types';
import type { RelativeUserInfo } from '../../types/user-types';
-import { messagePreviewText, removeCreatorAsViewer } from '../message-utils';
+import { removeCreatorAsViewer } from '../message-utils';
import { threadIsGroupChat } from '../thread-utils';
import { stringForUser } from '../user-utils';
import { hasMinCodeVersion } from '../version-utils';
@@ -51,14 +51,19 @@
messageTitle({
messageInfo,
- threadInfo,
viewerContext,
}: MessageTitleParam<ReactionMessageInfo>) {
let validMessageInfo: ReactionMessageInfo = (messageInfo: ReactionMessageInfo);
if (viewerContext === 'global_viewer') {
validMessageInfo = removeCreatorAsViewer(validMessageInfo);
}
- return messagePreviewText(validMessageInfo, threadInfo);
+
+ const creator = stringForUser(validMessageInfo.creator);
+ const preview =
+ validMessageInfo.action === 'add_reaction'
+ ? 'liked a message'
+ : 'unliked a message';
+ return `${creator} ${preview}`;
},
rawMessageInfoFromServerDBRow(row: Object): RawReactionMessageInfo {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 1, 7:09 PM (16 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2605863
Default Alt Text
D5886.diff (4 KB)
Attached To
Mode
D5886: [lib] put messagePreview function for mutlimedia and reaction message into respecitve message spec
Attached
Detach File
Event Timeline
Log In to Comment