Page MenuHomePhabricator

D5886.id20183.diff
No OneTemporary

D5886.id20183.diff

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

Mime Type
text/plain
Expires
Fri, Nov 29, 4:47 AM (20 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2595847
Default Alt Text
D5886.id20183.diff (4 KB)

Event Timeline