Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3361681
D13057.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
D13057.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D13057: [lib] Add function allowing extracting ThreadInfo from updates
Attached
Detach File
Event Timeline
Log In to Comment