Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33607946
D13348.1769120312.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
D13348.1769120312.diff
View Options
diff --git a/lib/shared/dm-ops/delete-entry-spec.js b/lib/shared/dm-ops/delete-entry-spec.js
--- a/lib/shared/dm-ops/delete-entry-spec.js
+++ b/lib/shared/dm-ops/delete-entry-spec.js
@@ -1,5 +1,6 @@
// @flow
+import invariant from 'invariant';
import uuid from 'uuid';
import type {
@@ -7,7 +8,6 @@
ProcessDMOperationUtilities,
} from './dm-op-spec.js';
import type { DMDeleteEntryOperation } from '../../types/dm-ops.js';
-import type { ThickRawEntryInfo } from '../../types/entry-types.js';
import { messageTypes } from '../../types/message-types-enum.js';
import { updateTypes } from '../../types/update-types-enum.js';
import type { EntryUpdateInfo } from '../../types/update-types.js';
@@ -33,7 +33,11 @@
const messageData = createMessageDataFromDMOperation(dmOperation);
return { messageDatas: [messageData] };
},
- processDMOperation: async (dmOperation: DMDeleteEntryOperation) => {
+ processDMOperation: async (
+ dmOperation: DMDeleteEntryOperation,
+ viewerID: string,
+ utilities: ProcessDMOperationUtilities,
+ ) => {
const {
threadID,
creatorID,
@@ -45,13 +49,24 @@
messageID,
} = dmOperation;
+ const rawEntryInfo = utilities.entryInfos[entryID];
const messageData = createMessageDataFromDMOperation(dmOperation);
const rawMessageInfos = [
rawMessageInfoFromMessageData(messageData, messageID),
];
+ invariant(rawEntryInfo?.thick, 'Entry thread should be thick');
+ const timestamp = rawEntryInfo.lastUpdatedTime;
+
+ if (timestamp > time) {
+ return {
+ rawMessageInfos,
+ updateInfos: [],
+ };
+ }
+
const date = dateFromString(dateString);
- const rawEntryInfo: ThickRawEntryInfo = {
+ const rawEntryInfoToUpdate = {
id: entryID,
threadID,
text: prevText,
@@ -66,7 +81,7 @@
};
const entryUpdateInfo: EntryUpdateInfo = {
- entryInfo: rawEntryInfo,
+ entryInfo: rawEntryInfoToUpdate,
type: updateTypes.UPDATE_ENTRY,
id: uuid.v4(),
time,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 22, 10:18 PM (20 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5980759
Default Alt Text
D13348.1769120312.diff (2 KB)
Attached To
Mode
D13348: [lib] check timestamps before processing delete entry operation
Attached
Detach File
Event Timeline
Log In to Comment