Page MenuHomePhabricator

D10271.id34448.diff
No OneTemporary

D10271.id34448.diff

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

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)

Event Timeline