Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33382881
D13215.1768964538.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D13215.1768964538.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
Wed, Jan 21, 3:02 AM (4 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5963376
Default Alt Text
D13215.1768964538.diff (2 KB)
Attached To
Mode
D13215: [lib] Check the timestamps when changing thread settings
Attached
Detach File
Event Timeline
Log In to Comment