Page MenuHomePhabricator

D13215.id43926.diff
No OneTemporary

D13215.id43926.diff

diff --git a/lib/shared/dm-ops/change-thread-settings-spec.js b/lib/shared/dm-ops/change-thread-settings-spec.js
--- a/lib/shared/dm-ops/change-thread-settings-spec.js
+++ b/lib/shared/dm-ops/change-thread-settings-spec.js
@@ -14,7 +14,10 @@
import type { MessageData, RawMessageInfo } from '../../types/message-types';
import { messageTypes } from '../../types/message-types-enum.js';
import type { ChangeSettingsMessageData } from '../../types/messages/change-settings.js';
-import type { RawThreadInfo } from '../../types/minimally-encoded-thread-permissions-types.js';
+import type {
+ RawThreadInfo,
+ ThickRawThreadInfo,
+} from '../../types/minimally-encoded-thread-permissions-types.js';
import { updateTypes } from '../../types/update-types-enum.js';
import type { ClientUpdateInfo } from '../../types/update-types.js';
import { values } from '../../utils/objects.js';
@@ -100,11 +103,10 @@
const { time, messageIDsPrefix } = dmOperation;
const threadID = getThreadIDFromChangeThreadSettingsDMOp(dmOperation);
- let threadInfoToUpdate: ?RawThreadInfo = utilities.threadInfos[threadID];
+ const threadInfo: ?RawThreadInfo = utilities.threadInfos[threadID];
const updateInfos: Array<ClientUpdateInfo> = [];
const rawMessageInfos: Array<RawMessageInfo> = [];
- invariant(threadInfoToUpdate?.thick, 'Thread should be thick');
const { fieldNameToMessageData, threadInfoUpdate } =
createChangeSettingsMessageDatasAndUpdate(dmOperation);
@@ -120,10 +122,21 @@
),
);
- threadInfoToUpdate = {
- ...threadInfoToUpdate,
- ...threadInfoUpdate,
- };
+ invariant(threadInfo?.thick, 'Thread should be thick');
+ let threadInfoToUpdate: ThickRawThreadInfo = threadInfo;
+ for (const fieldName in threadInfoUpdate) {
+ const timestamp = threadInfoToUpdate.timestamps[fieldName];
+ if (timestamp < time) {
+ threadInfoToUpdate = {
+ ...threadInfoToUpdate,
+ [fieldName]: threadInfoUpdate[fieldName],
+ timestamps: {
+ ...threadInfoToUpdate.timestamps,
+ [fieldName]: time,
+ },
+ };
+ }
+ }
if (fieldNameToMessageDataPairs.length > 0) {
updateInfos.push({

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 8, 7:34 PM (20 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2444747
Default Alt Text
D13215.id43926.diff (2 KB)

Event Timeline