Page MenuHomePhabricator

D13688.id.diff
No OneTemporary

D13688.id.diff

diff --git a/lib/shared/messages/update-relationship-message-spec.js b/lib/shared/messages/update-relationship-message-spec.js
--- a/lib/shared/messages/update-relationship-message-spec.js
+++ b/lib/shared/messages/update-relationship-message-spec.js
@@ -6,9 +6,11 @@
import {
type CreateMessageInfoParams,
type MessageSpec,
+ type MergeRobotextMessageItemResult,
pushTypes,
} from './message-spec.js';
import { assertSingleMessageInfo } from './utils.js';
+import type { RobotextChatMessageInfoItem } from '../../selectors/chat-selectors.js';
import type { PlatformDetails } from '../../types/device-types.js';
import { messageTypes } from '../../types/message-types-enum.js';
import type {
@@ -357,4 +359,39 @@
rawLegacyUpdateRelationshipMessageInfoValidator,
rawUpdateRelationshipMessageInfoValidator,
]),
+
+ mergeIntoPrecedingRobotextMessageItem(
+ messageInfo:
+ | LegacyUpdateRelationshipMessageInfo
+ | UpdateRelationshipMessageInfo,
+ precedingMessageInfoItem: RobotextChatMessageInfoItem,
+ ): MergeRobotextMessageItemResult {
+ if (
+ messageInfo.type !== messageTypes.UPDATE_RELATIONSHIP ||
+ messageInfo.operation !== 'farcaster_mutual' ||
+ precedingMessageInfoItem.messageInfos.length !== 1 ||
+ precedingMessageInfoItem.messageInfos[0].type !==
+ messageTypes.CREATE_THREAD
+ ) {
+ return { shouldMerge: false };
+ }
+ const createThreadMessageInfo = precedingMessageInfoItem.messageInfos[0];
+
+ const viewerIsCreator = messageInfo.creator.isViewer;
+ const farcasterFriendFID = viewerIsCreator
+ ? messageInfo.targetFID
+ : messageInfo.creatorFID;
+ const farcasterFriend = ET.fcUser({ fid: farcasterFriendFID });
+
+ const startingText = 'Comm auto-created this chat with';
+ const endingText = 'from Farcaster';
+ const newRobotext = ET`${startingText} ${farcasterFriend} ${endingText}`;
+
+ const mergedItem = {
+ ...precedingMessageInfoItem,
+ messageInfos: [messageInfo, createThreadMessageInfo],
+ robotext: newRobotext,
+ };
+ return { shouldMerge: true, item: mergedItem };
+ },
});

File Metadata

Mime Type
text/plain
Expires
Wed, Oct 30, 8:17 PM (9 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2389423
Default Alt Text
D13688.id.diff (2 KB)

Event Timeline