Page MenuHomePhabricator

D13240.id43883.diff
No OneTemporary

D13240.id43883.diff

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

Mime Type
text/plain
Expires
Sat, Oct 19, 5:15 PM (19 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2324151
Default Alt Text
D13240.id43883.diff (1 KB)

Event Timeline