Page MenuHomePhabricator

D11459.diff
No OneTemporary

D11459.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
@@ -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

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)

Event Timeline