Changeset View
Changeset View
Standalone View
Standalone View
lib/selectors/chat-selectors.js
Show First 20 Lines • Show All 323 Lines • ▼ Show 20 Lines | ): ChatMessageItem[] { | |||||||||||
const targetMessageReactionsMap = new Map<string, TargetMessageReactions>(); | const targetMessageReactionsMap = new Map<string, TargetMessageReactions>(); | |||||||||||
// We need to iterate backwards to put the order of messages in chronological | // We need to iterate backwards to put the order of messages in chronological | |||||||||||
// order, starting with the oldest. This avoids the scenario where the most | // order, starting with the oldest. This avoids the scenario where the most | |||||||||||
// recent message with the remove_reaction action may try to remove a user | // recent message with the remove_reaction action may try to remove a user | |||||||||||
// that hasn't been added to the messageReactionUsersInfoMap, causing it | // that hasn't been added to the messageReactionUsersInfoMap, causing it | |||||||||||
// to be skipped. | // to be skipped. | |||||||||||
for (let i = messages.length - 1; i >= 0; i--) { | for (let i = messages.length - 1; i >= 0; i--) { | |||||||||||
const messageInfo = messages[i]; | const messageInfo = messages[i]; | |||||||||||
ashoatUnsubmitted Done Inline Actions
ashoat: | ||||||||||||
if (messageInfo.type !== messageTypes.REACTION) { | if (messageInfo.type !== messageTypes.REACTION) { | |||||||||||
continue; | continue; | |||||||||||
} | } | |||||||||||
if (!targetMessageReactionsMap.has(messageInfo.targetMessageID)) { | if (!targetMessageReactionsMap.has(messageInfo.targetMessageID)) { | |||||||||||
const reactsMap: TargetMessageReactions = new Map(); | const reactsMap: TargetMessageReactions = new Map(); | |||||||||||
targetMessageReactionsMap.set(messageInfo.targetMessageID, reactsMap); | targetMessageReactionsMap.set(messageInfo.targetMessageID, reactsMap); | |||||||||||
} | } | |||||||||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | for (let i = messages.length - 1; i >= 0; i--) { | |||||||||||
if (isEmptyMediaMessage(originalMessageInfo)) { | if (isEmptyMediaMessage(originalMessageInfo)) { | |||||||||||
continue; | continue; | |||||||||||
} | } | |||||||||||
if (messageInfo.type === messageTypes.TEXT && messageInfo.id) { | if (messageInfo.type === messageTypes.TEXT && messageInfo.id) { | |||||||||||
const newText = targetMessageEditMap.get(messageInfo.id); | const newText = targetMessageEditMap.get(messageInfo.id); | |||||||||||
if (newText !== undefined) { | if (newText !== undefined) { | |||||||||||
messageInfo.text = newText; | messageInfo.text = newText; | |||||||||||
messageInfo.hasBeenEdited = true; | ||||||||||||
ashoatUnsubmitted Done Inline Actions
To work with a read-only type, you can do this ashoat: To work with a read-only type, you can do this | ||||||||||||
} | } | |||||||||||
} | } | |||||||||||
let startsConversation = true; | let startsConversation = true; | |||||||||||
let startsCluster = true; | let startsCluster = true; | |||||||||||
if ( | if ( | |||||||||||
lastMessageInfo && | lastMessageInfo && | |||||||||||
lastMessageInfo.time + msInFiveMinutes > originalMessageInfo.time | lastMessageInfo.time + msInFiveMinutes > originalMessageInfo.time | |||||||||||
▲ Show 20 Lines • Show All 219 Lines • Show Last 20 Lines |