Page MenuHomePhorge

D14692.1765335910.diff
No OneTemporary

Size
4 KB
Referenced Files
None
Subscribers
None

D14692.1765335910.diff

diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js
--- a/lib/shared/thread-utils.js
+++ b/lib/shared/thread-utils.js
@@ -82,7 +82,6 @@
type ThreadType,
threadTypes,
assertThreadType,
- threadTypeIsThick,
type ThinThreadType,
} from '../types/thread-types-enum.js';
import type {
@@ -169,25 +168,6 @@
return communityRootMembersToRole;
}
-// This function returns true for all thick threads, as well as all channels
-// inside GENESIS. Channels inside GENESIS were used in place of thick threads
-// before thick threads were launched, and as such we mirror "freezing" behavior
-// between them and thick threads. "Freezing" a thread can occur when a user
-// blocks another user, and those two users are the only members of a given
-// chat. Note that we exclude the GENESIS community root here, as the root
-// itself has never been used in place of thick threads. Also note that
-// grandchild channels of GENESIS get this behavior too, even though we don't
-// currently support channels inside thick threads.
-function threadIsThickOrChannelInsideGenesis(threadInfo: ThreadInfo): boolean {
- if (threadTypeIsThick(threadInfo.type)) {
- return true;
- }
- if (getCommunity(threadInfo) !== genesis().id) {
- return false;
- }
- return threadInfo.id !== genesis().id;
-}
-
function useThreadsWithPermission(
threadInfos: $ReadOnlyArray<ThreadInfo>,
permission: ThreadPermission,
@@ -197,8 +177,9 @@
return React.useMemo(() => {
return threadInfos.filter((threadInfo: ThreadInfo) => {
- const isGroupChat = threadIsThickOrChannelInsideGenesis(threadInfo);
- if (!isGroupChat || !loggedInUserInfo) {
+ const canBeFrozen =
+ threadSpecs[threadInfo.type].protocol.canBeFrozen(threadInfo);
+ if (!canBeFrozen || !loggedInUserInfo) {
return hasPermission(threadInfo.currentUser.permissions, permission);
}
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
@@ -729,6 +729,8 @@
couldBeCreatedFromPendingThread: () => true,
+ canBeFrozen: () => true,
+
allowsDeletingSidebarSource: false,
presentationDetails: {
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
@@ -40,6 +40,7 @@
import { getMediaMessageServerDBContentsFromMedia } from '../../../types/messages/media.js';
import type { RawReactionMessageInfo } from '../../../types/messages/reaction.js';
import type {
+ ThreadInfo,
RoleInfo,
ThreadCurrentUserInfo,
ThinRawThreadInfo,
@@ -500,6 +501,19 @@
);
},
+ // Channels inside GENESIS were used in place of thick threads before thick
+ // threads were launched, and as such we mirror "freezing" behavior between
+ // them and thick threads. Note that we exclude the GENESIS community root
+ // here, as the root itself has never been used in place of thick threads.
+ // Also note that grandchild channels of GENESIS get this behavior too,
+ // even though we don't currently support channels inside thick threads.
+ canBeFrozen: (thread: ThreadInfo) => {
+ if (getCommunity(thread) !== genesis().id) {
+ return false;
+ }
+ return thread.id !== genesis().id;
+ },
+
allowsDeletingSidebarSource: true,
presentationDetails: {
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
@@ -311,6 +311,9 @@
input: ProtocolCreatePendingThreadInput,
) => RawThreadInfo,
+couldBeCreatedFromPendingThread: (thread: RawThreadInfo) => boolean,
+ // "Freezing" a thread can occur when a user blocks another user, and those
+ // two users are the only members of a given chat.
+ +canBeFrozen: (thread: ThreadInfo) => boolean,
+allowsDeletingSidebarSource: boolean,
+presentationDetails: {
+membershipChangesShownInThreadPreview: boolean,

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 10, 3:05 AM (13 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5860300
Default Alt Text
D14692.1765335910.diff (4 KB)

Event Timeline