Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3159371
D10271.id34448.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
D10271.id34448.diff
View Options
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
@@ -4,8 +4,8 @@
import type { UpdateSpec } from './update-spec.js';
import type {
- LegacyRawThreadInfo,
- LegacyRawThreadInfos,
+ RawThreadInfo,
+ RawThreadInfos,
} from '../../types/thread-types.js';
import { updateTypes } from '../../types/update-types-enum.js';
import type {
@@ -21,33 +21,52 @@
ThreadReadStatusUpdateData,
> = Object.freeze({
generateOpsForThreadUpdates(
- storeThreadInfos: LegacyRawThreadInfos,
+ storeThreadInfos: RawThreadInfos,
update: ThreadReadStatusUpdateInfo,
) {
- const storeThreadInfo: ?LegacyRawThreadInfo =
- storeThreadInfos[update.threadID];
if (
- !storeThreadInfo ||
- storeThreadInfo.currentUser.unread === update.unread
+ !storeThreadInfos[update.threadID] ||
+ storeThreadInfos[update.threadID].currentUser.unread === update.unread
) {
return null;
}
- const updatedThread = {
- ...storeThreadInfo,
- currentUser: {
- ...storeThreadInfo.currentUser,
- unread: update.unread,
- },
- };
- return [
- {
- type: 'replace',
- payload: {
- id: update.threadID,
- threadInfo: updatedThread,
+ const storeThreadInfo: RawThreadInfo = storeThreadInfos[update.threadID];
+ // TODO (atul): Try to get rid of this ridiculous branching.
+ if (storeThreadInfo.minimallyEncoded) {
+ const updatedThread = {
+ ...storeThreadInfo,
+ currentUser: {
+ ...storeThreadInfo.currentUser,
+ unread: update.unread,
+ },
+ };
+ return [
+ {
+ type: 'replace',
+ payload: {
+ id: update.threadID,
+ threadInfo: updatedThread,
+ },
+ },
+ ];
+ } else {
+ const updatedThread = {
+ ...storeThreadInfo,
+ currentUser: {
+ ...storeThreadInfo.currentUser,
+ unread: update.unread,
},
- },
- ];
+ };
+ return [
+ {
+ type: 'replace',
+ payload: {
+ id: update.threadID,
+ threadInfo: updatedThread,
+ },
+ },
+ ];
+ }
},
rawUpdateInfoFromRow(row: Object) {
const { threadID, unread } = JSON.parse(row.content);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 6, 10:31 PM (20 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2433419
Default Alt Text
D10271.id34448.diff (2 KB)
Attached To
Mode
D10271: [lib] Add ridiculous branching to `update-thread-read-status-spec` to appease `flow`
Attached
Detach File
Event Timeline
Log In to Comment