Page MenuHomePhabricator

D13057.diff
No OneTemporary

D13057.diff

diff --git a/lib/shared/updates/join-thread-spec.js b/lib/shared/updates/join-thread-spec.js
--- a/lib/shared/updates/join-thread-spec.js
+++ b/lib/shared/updates/join-thread-spec.js
@@ -178,4 +178,7 @@
truncationStatus: messageTruncationStatusValidator,
rawEntryInfos: t.list(rawEntryInfoValidator),
}),
+ getUpdatedThreadInfo(update: ThreadJoinUpdateInfo) {
+ return update.threadInfo;
+ },
});
diff --git a/lib/shared/updates/update-spec.js b/lib/shared/updates/update-spec.js
--- a/lib/shared/updates/update-spec.js
+++ b/lib/shared/updates/update-spec.js
@@ -14,9 +14,11 @@
MessageTruncationStatuses,
FetchMessageInfosResult,
} from '../../types/message-types.js';
+import type { RawThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js';
import type {
RawThreadInfos,
MixedRawThreadInfos,
+ LegacyRawThreadInfo,
} from '../../types/thread-types.js';
import type { UpdateType } from '../../types/update-types-enum.js';
import type {
@@ -103,4 +105,10 @@
+generateOpsForUserInfoUpdates?: (
update: UpdateInfo,
) => ?$ReadOnlyArray<UserStoreOperation>,
+ +getUpdatedThreadInfo?: (
+ update: UpdateInfo,
+ threadInfos: {
+ +[string]: LegacyRawThreadInfo | RawThreadInfo,
+ },
+ ) => ?(LegacyRawThreadInfo | RawThreadInfo),
};
diff --git a/lib/shared/updates/update-thread-read-status-spec.js b/lib/shared/updates/update-thread-read-status-spec.js
--- a/lib/shared/updates/update-thread-read-status-spec.js
+++ b/lib/shared/updates/update-thread-read-status-spec.js
@@ -3,7 +3,11 @@
import t from 'tcomb';
import type { UpdateSpec } from './update-spec.js';
-import type { RawThreadInfos } from '../../types/thread-types.js';
+import type { RawThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js';
+import type {
+ LegacyRawThreadInfo,
+ RawThreadInfos,
+} from '../../types/thread-types.js';
import { updateTypes } from '../../types/update-types-enum.js';
import type {
ThreadReadStatusUpdateInfo,
@@ -106,4 +110,31 @@
threadID: tID,
unread: t.Boolean,
}),
+ getUpdatedThreadInfo(
+ update: ThreadReadStatusUpdateInfo,
+ threadInfos: {
+ +[string]: LegacyRawThreadInfo | RawThreadInfo,
+ },
+ ): ?(LegacyRawThreadInfo | RawThreadInfo) {
+ const threadInfo = threadInfos[update.threadID];
+ if (!threadInfo) {
+ return null;
+ }
+ if (threadInfo.minimallyEncoded) {
+ return {
+ ...threadInfo,
+ currentUser: {
+ ...threadInfo.currentUser,
+ unread: update.unread,
+ },
+ };
+ }
+ return {
+ ...threadInfo,
+ currentUser: {
+ ...threadInfo.currentUser,
+ unread: update.unread,
+ },
+ };
+ },
});
diff --git a/lib/shared/updates/update-thread-spec.js b/lib/shared/updates/update-thread-spec.js
--- a/lib/shared/updates/update-thread-spec.js
+++ b/lib/shared/updates/update-thread-spec.js
@@ -119,4 +119,7 @@
time: t.Number,
threadInfo: mixedRawThreadInfoValidator,
}),
+ getUpdatedThreadInfo(update: ThreadUpdateInfo) {
+ return update.threadInfo;
+ },
});

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 6:51 PM (21 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2580711
Default Alt Text
D13057.diff (3 KB)

Event Timeline