Page MenuHomePhorge

D5811.1765047107.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D5811.1765047107.diff

diff --git a/lib/selectors/chat-selectors.js b/lib/selectors/chat-selectors.js
--- a/lib/selectors/chat-selectors.js
+++ b/lib/selectors/chat-selectors.js
@@ -26,6 +26,7 @@
type MessageInfo,
type MessageStore,
type ComposableMessageInfo,
+ type ReactionMessageInfo,
type RobotextMessageInfo,
type LocalMessageInfo,
messageTypes,
@@ -272,6 +273,7 @@
endsCluster: boolean,
+robotext: string,
+threadCreatedFromMessage: ?ThreadInfo,
+ +reactions?: $ReadOnlyArray<ReactionMessageInfo>,
};
export type ChatMessageInfoItem =
| RobotextChatMessageInfoItem
@@ -283,6 +285,7 @@
+startsCluster: boolean,
endsCluster: boolean,
+threadCreatedFromMessage: ?ThreadInfo,
+ +reactions?: $ReadOnlyArray<ReactionMessageInfo>,
};
export type ChatMessageItem = { itemType: 'loader' } | ChatMessageInfoItem;
const msInFiveMinutes = 5 * 60 * 1000;
@@ -304,6 +307,21 @@
? sortMessageInfoList([...threadMessageInfos, ...additionalMessages])
: threadMessageInfos;
+ const reactionsMap = new Map<string, Array<ReactionMessageInfo>>();
+
+ for (let i = 0; i < messages.length; i++) {
+ const messageInfo = messages[i];
+ if (messageInfo.type !== messageTypes.REACTION) {
+ continue;
+ }
+
+ if (reactionsMap.has(messageInfo.targetMessageID)) {
+ reactionsMap.get(messageInfo.targetMessageID)?.push(messageInfo);
+ } else {
+ reactionsMap.set(messageInfo.targetMessageID, [messageInfo]);
+ }
+ }
+
const chatMessageItems = [];
let lastMessageInfo = null;
for (let i = messages.length - 1; i >= 0; i--) {
@@ -358,6 +376,12 @@
);
const localMessageInfo =
messageStore.local[messageKey(originalMessageInfo)];
+
+ let reactions;
+ if (originalMessageInfo.id) {
+ reactions = reactionsMap.get(originalMessageInfo.id);
+ }
+
chatMessageItems.push({
itemType: 'message',
messageInfo: originalMessageInfo,
@@ -366,6 +390,7 @@
startsCluster,
endsCluster: false,
threadCreatedFromMessage,
+ reactions,
});
} else {
invariant(
@@ -386,6 +411,7 @@
endsCluster: false,
threadCreatedFromMessage,
robotext,
+ reactions: reactionsMap.get(originalMessageInfo.id),
});
}
lastMessageInfo = originalMessageInfo;

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 6, 6:51 PM (20 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5840261
Default Alt Text
D5811.1765047107.diff (2 KB)

Event Timeline