Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3352570
D11459.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D11459.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
@@ -9,6 +9,7 @@
pushTypes,
} from './message-spec.js';
import { assertSingleMessageInfo } from './utils.js';
+import type { PlatformDetails } from '../../types/device-types.js';
import { messageTypes } from '../../types/message-types-enum.js';
import type {
ClientDBMessageInfo,
@@ -20,6 +21,7 @@
type LegacyUpdateRelationshipMessageData,
type LegacyUpdateRelationshipMessageInfo,
} from '../../types/messages/legacy-update-relationship.js';
+import type { RawUnsupportedMessageInfo } from '../../types/messages/unsupported.js';
import type {
RawUpdateRelationshipMessageInfo,
UpdateRelationshipMessageData,
@@ -30,6 +32,7 @@
import type { NotifTexts } from '../../types/notif-types.js';
import type { RelativeUserInfo } from '../../types/user-types.js';
import { type EntityText, ET } from '../../utils/entity-text.js';
+import { FUTURE_CODE_VERSION, hasMinCodeVersion } from '../version-utils.js';
type UpdateRelationshipMessageSpec = MessageSpec<
LegacyUpdateRelationshipMessageData | UpdateRelationshipMessageData,
@@ -48,6 +51,8 @@
...
};
+const connectionOnFarcasterMessage = 'Your connection on Farcaster is on Comm.';
+
export const updateRelationshipMessageSpec: UpdateRelationshipMessageSpec =
Object.freeze({
messageContentForServerDB(
@@ -190,7 +195,7 @@
});
return ET`${creator} accepted ${targetPossessive} friend request`;
} else if (messageInfo.operation === 'farcaster_mutual') {
- return ET`Your connection on Farcaster is on Comm.`;
+ return ET`${connectionOnFarcasterMessage}`;
}
invariant(
false,
@@ -199,6 +204,48 @@
);
},
+ shimUnsupportedMessageInfo(
+ rawMessageInfo:
+ | RawUpdateRelationshipMessageInfo
+ | RawLegacyUpdateRelationshipMessageInfo,
+ platformDetails: ?PlatformDetails,
+ ):
+ | RawLegacyUpdateRelationshipMessageInfo
+ | RawUpdateRelationshipMessageInfo
+ | RawUnsupportedMessageInfo {
+ if (rawMessageInfo.type === messageTypes.LEGACY_UPDATE_RELATIONSHIP) {
+ return rawMessageInfo;
+ } else if (
+ rawMessageInfo.type === messageTypes.UPDATE_RELATIONSHIP &&
+ hasMinCodeVersion(platformDetails, {
+ native: FUTURE_CODE_VERSION,
+ web: FUTURE_CODE_VERSION,
+ majorDesktop: FUTURE_CODE_VERSION,
+ })
+ ) {
+ return rawMessageInfo;
+ } else if (
+ rawMessageInfo.type === messageTypes.UPDATE_RELATIONSHIP &&
+ rawMessageInfo.operation !== 'farcaster_mutual'
+ ) {
+ return {
+ ...rawMessageInfo,
+ type: messageTypes.LEGACY_UPDATE_RELATIONSHIP,
+ operation: rawMessageInfo.operation,
+ };
+ } else {
+ return {
+ type: messageTypes.UNSUPPORTED,
+ id: rawMessageInfo.id,
+ threadID: rawMessageInfo.threadID,
+ creatorID: rawMessageInfo.creatorID,
+ time: rawMessageInfo.time,
+ robotext: connectionOnFarcasterMessage,
+ unsupportedMessageInfo: rawMessageInfo,
+ };
+ }
+ },
+
unshimMessageInfo(
unwrapped:
| RawLegacyUpdateRelationshipMessageInfo
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 6:29 AM (21 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2574294
Default Alt Text
D11459.diff (3 KB)
Attached To
Mode
D11459: [lib] Implement `UpdateRelationshipSpec.shimUnsupportedMessageInfo`
Attached
Detach File
Event Timeline
Log In to Comment