Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33029953
D14608.1768400628.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
D14608.1768400628.diff
View Options
diff --git a/lib/shared/threads/protocols/dm-thread-protocol.js b/lib/shared/threads/protocols/dm-thread-protocol.js
--- a/lib/shared/threads/protocols/dm-thread-protocol.js
+++ b/lib/shared/threads/protocols/dm-thread-protocol.js
@@ -431,6 +431,8 @@
},
membershipChangesShownInThreadPreview: true,
+
+ allowsDeletingSidebarSource: false,
});
export { dmThreadProtocol };
diff --git a/lib/shared/threads/protocols/keyserver-thread-protocol.js b/lib/shared/threads/protocols/keyserver-thread-protocol.js
--- a/lib/shared/threads/protocols/keyserver-thread-protocol.js
+++ b/lib/shared/threads/protocols/keyserver-thread-protocol.js
@@ -214,6 +214,8 @@
},
membershipChangesShownInThreadPreview: false,
+
+ allowsDeletingSidebarSource: true,
});
function mediaIDIsKeyserverID(mediaID: string): boolean {
diff --git a/lib/shared/threads/thread-spec.js b/lib/shared/threads/thread-spec.js
--- a/lib/shared/threads/thread-spec.js
+++ b/lib/shared/threads/thread-spec.js
@@ -185,6 +185,7 @@
utils: SetThreadUnreadStatusUtils,
) => Promise<SetThreadUnreadStatusPayload>,
+membershipChangesShownInThreadPreview: boolean,
+ +allowsDeletingSidebarSource: boolean,
};
export type ThreadSpec = {
diff --git a/lib/utils/delete-message-utils.js b/lib/utils/delete-message-utils.js
--- a/lib/utils/delete-message-utils.js
+++ b/lib/utils/delete-message-utils.js
@@ -14,15 +14,13 @@
} from '../shared/dm-ops/dm-op-types.js';
import { useProcessAndSendDMOperation } from '../shared/dm-ops/process-dm-ops.js';
import { useThreadHasPermission } from '../shared/thread-utils.js';
+import { threadSpecs } from '../shared/threads/thread-specs.js';
import type { DMSendDeleteMessageOperation } from '../types/dm-ops.js';
import type { MessageInfo } from '../types/message-types.js';
import { isComposableMessageType } from '../types/message-types.js';
import type { ThreadInfo } from '../types/minimally-encoded-thread-permissions-types.js';
import { threadPermissions } from '../types/thread-permission-types.js';
-import {
- thickThreadTypes,
- threadTypeIsThick,
-} from '../types/thread-types-enum.js';
+import { thickThreadTypes } from '../types/thread-types-enum.js';
const deletedMessageText = 'Deleted message';
@@ -108,12 +106,8 @@
return false;
}
- if (canDeleteAllMessages) {
- return true;
- }
-
if (
- threadTypeIsThick(threadInfo.type) &&
+ !threadSpecs[threadInfo.type].protocol.allowsDeletingSidebarSource &&
(targetMessageInfo.time < threadInfo.creationTime ||
threadCreatedFromMessage)
) {
@@ -123,6 +117,10 @@
return false;
}
+ if (canDeleteAllMessages) {
+ return true;
+ }
+
return (
currentUserInfo.id === targetMessageInfo.creator.id && canDeleteOwnMessages
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 14, 2:23 PM (4 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5932418
Default Alt Text
D14608.1768400628.diff (2 KB)
Attached To
Mode
D14608: [lib] Move sidebar source deletion check to a spec
Attached
Detach File
Event Timeline
Log In to Comment