Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32555573
D9402.1767200080.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D9402.1767200080.diff
View Options
diff --git a/lib/reducers/thread-activity-reducer.js b/lib/reducers/thread-activity-reducer.js
--- a/lib/reducers/thread-activity-reducer.js
+++ b/lib/reducers/thread-activity-reducer.js
@@ -1,5 +1,9 @@
// @flow
+import {
+ deleteThreadActionTypes,
+ leaveThreadActionTypes,
+} from '../actions/thread-actions.js';
import {
logOutActionTypes,
deleteAccountActionTypes,
@@ -7,6 +11,8 @@
import type { BaseAction } from '../types/redux-types.js';
import type { ThreadActivityStore } from '../types/thread-activity-types.js';
import { updateThreadLastNavigatedActionType } from '../types/thread-activity-types.js';
+import { updateTypes } from '../types/update-types-enum.js';
+import type { ClientUpdateInfo } from '../types/update-types.js';
import { setNewSessionActionType } from '../utils/action-utils.js';
function reduceThreadActivity(
@@ -23,6 +29,24 @@
},
};
return updatedThreadActivityStore;
+ } else if (
+ action.type === leaveThreadActionTypes.success ||
+ action.type === deleteThreadActionTypes.success
+ ) {
+ const { newUpdates } = action.payload.updatesResult;
+ if (newUpdates.length === 0) {
+ return state;
+ }
+
+ let updatedState = { ...state };
+ for (const update: ClientUpdateInfo of newUpdates) {
+ if (update.type === updateTypes.DELETE_THREAD) {
+ const { [update.threadID]: _, ...stateSansRemovedThread } =
+ updatedState;
+ updatedState = stateSansRemovedThread;
+ }
+ }
+ return updatedState;
} else if (
action.type === logOutActionTypes.success ||
action.type === deleteAccountActionTypes.success ||
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 31, 4:54 PM (11 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5874155
Default Alt Text
D9402.1767200080.diff (1 KB)
Attached To
Mode
D9402: [lib] Handle `[leave/delete]ThreadActionTypes.success` in `reduceThreadActivity`
Attached
Detach File
Event Timeline
Log In to Comment