Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3175076
D13215.id43918.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D13215.id43918.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 8, 7:33 PM (20 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2444747
Default Alt Text
D13215.id43918.diff (2 KB)
Attached To
Mode
D13215: [lib] Check the timestamps when changing thread settings
Attached
Detach File
Event Timeline
Log In to Comment