Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3099134
D13688.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D13688.id.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D13688: [lib] Explain auto-created Farcaster mutual friend threads better
Attached
Detach File
Event Timeline
Log In to Comment