Page MenuHomePhabricator

D10558.diff
No OneTemporary

D10558.diff

diff --git a/lib/reducers/thread-reducer.js b/lib/reducers/thread-reducer.js
--- a/lib/reducers/thread-reducer.js
+++ b/lib/reducers/thread-reducer.js
@@ -372,60 +372,40 @@
} else if (action.type === setThreadUnreadStatusActionTypes.started) {
const { threadID, unread } = action.payload;
const threadInfo = state.threadInfos[threadID];
- // TODO (atul): Try to get rid of this ridiculous branching.
- if (threadInfo.minimallyEncoded) {
- const updatedThreadInfo = {
- ...threadInfo,
- currentUser: {
- ...threadInfo.currentUser,
- unread,
- },
- };
- const threadStoreOperations = [
- {
- type: 'replace',
- payload: {
- id: threadID,
- threadInfo: updatedThreadInfo,
+ const updatedThreadInfo = threadInfo.minimallyEncoded
+ ? {
+ ...threadInfo,
+ currentUser: {
+ ...threadInfo.currentUser,
+ unread,
},
- },
- ];
- const updatedThreadStore = processThreadStoreOperations(
- state,
- threadStoreOperations,
- );
- return {
- threadStore: updatedThreadStore,
- newThreadInconsistencies: [],
- threadStoreOperations,
- };
- } else {
- const updatedThreadInfo = {
- ...threadInfo,
- currentUser: {
- ...threadInfo.currentUser,
- unread,
- },
- };
- const threadStoreOperations = [
- {
- type: 'replace',
- payload: {
- id: threadID,
- threadInfo: updatedThreadInfo,
+ }
+ : {
+ ...threadInfo,
+ currentUser: {
+ ...threadInfo.currentUser,
+ unread,
},
+ };
+
+ const threadStoreOperations = [
+ {
+ type: 'replace',
+ payload: {
+ id: threadID,
+ threadInfo: updatedThreadInfo,
},
- ];
- const updatedThreadStore = processThreadStoreOperations(
- state,
- threadStoreOperations,
- );
- return {
- threadStore: updatedThreadStore,
- newThreadInconsistencies: [],
- threadStoreOperations,
- };
- }
+ },
+ ];
+ const updatedThreadStore = processThreadStoreOperations(
+ state,
+ threadStoreOperations,
+ );
+ return {
+ threadStore: updatedThreadStore,
+ newThreadInconsistencies: [],
+ threadStoreOperations,
+ };
} else if (action.type === setThreadUnreadStatusActionTypes.success) {
const { threadID, resetToUnread } = action.payload;
const currentUser = state.threadInfos[threadID].currentUser;

File Metadata

Mime Type
text/plain
Expires
Sun, Oct 6, 7:27 PM (21 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2250711
Default Alt Text
D10558.diff (2 KB)

Event Timeline