Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32562900
D13240.1767347268.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
D13240.1767347268.diff
View Options
diff --git a/lib/shared/dm-ops/change-thread-read-status-spec.js b/lib/shared/dm-ops/change-thread-read-status-spec.js
--- a/lib/shared/dm-ops/change-thread-read-status-spec.js
+++ b/lib/shared/dm-ops/change-thread-read-status-spec.js
@@ -1,5 +1,6 @@
// @flow
+import invariant from 'invariant';
import uuid from 'uuid';
import type {
@@ -22,15 +23,39 @@
},
processDMOperation: async (
dmOperation: DMChangeThreadReadStatusOperation,
+ viewerID: string,
+ utilities: ProcessDMOperationUtilities,
) => {
const { threadID, unread, time } = dmOperation;
+
+ const threadInfo = utilities.threadInfos[threadID];
+ invariant(threadInfo.thick, 'Thread should be thick');
+ if (threadInfo.timestamps.currentUser.unread > time) {
+ return {
+ rawMessageInfos: [],
+ updateInfos: [],
+ };
+ }
+
const updateInfos = [
{
- type: updateTypes.UPDATE_THREAD_READ_STATUS,
+ type: updateTypes.UPDATE_THREAD,
id: uuid.v4(),
time,
- threadID,
- unread,
+ threadInfo: {
+ ...threadInfo,
+ currentUser: {
+ ...threadInfo.currentUser,
+ unread,
+ },
+ timestamps: {
+ ...threadInfo.timestamps,
+ currentUser: {
+ ...threadInfo.timestamps.currentUser,
+ unread: time,
+ },
+ },
+ },
},
];
return {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 2, 9:47 AM (6 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5877875
Default Alt Text
D13240.1767347268.diff (1 KB)
Attached To
Mode
D13240: [lib] Check the timestamps when updating read status
Attached
Detach File
Event Timeline
Log In to Comment