Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3274031
D3261.id9805.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
D3261.id9805.diff
View Options
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
@@ -148,6 +148,10 @@
);
}
+function threadIsChannel(threadInfo: ?(ThreadInfo | RawThreadInfo)): boolean {
+ return !!(threadInfo && threadInfo.type !== threadTypes.SIDEBAR);
+}
+
function threadInBackgroundChatList(
threadInfo: ?(ThreadInfo | RawThreadInfo),
): boolean {
@@ -1274,6 +1278,7 @@
viewerIsMember,
threadInChatList,
threadIsTopLevel,
+ threadIsChannel,
threadInBackgroundChatList,
threadInHomeChatList,
threadIsInHome,
diff --git a/native/chat/settings/thread-settings.react.js b/native/chat/settings/thread-settings.react.js
--- a/native/chat/settings/thread-settings.react.js
+++ b/native/chat/settings/thread-settings.react.js
@@ -22,6 +22,7 @@
viewerIsMember,
threadInChatList,
getSingleOtherUser,
+ threadIsChannel,
} from 'lib/shared/thread-utils';
import threadWatcher from 'lib/shared/thread-watcher';
import type { RelationshipButton } from 'lib/types/relationship-types';
@@ -479,10 +480,7 @@
) => {
const listData: ChatSettingsItem[] = [];
- const subchannels =
- childThreads?.filter(
- childThreadInfo => childThreadInfo.type !== threadTypes.SIDEBAR,
- ) ?? [];
+ const subchannels = childThreads?.filter(threadIsChannel) ?? [];
const canCreateSubchannels = threadHasPermission(
threadInfo,
threadPermissions.CREATE_SUBCHANNELS,
diff --git a/web/chat/thread-menu.react.js b/web/chat/thread-menu.react.js
--- a/web/chat/thread-menu.react.js
+++ b/web/chat/thread-menu.react.js
@@ -11,7 +11,7 @@
import * as React from 'react';
import { childThreadInfos } from 'lib/selectors/thread-selectors';
-import { threadHasPermission } from 'lib/shared/thread-utils';
+import { threadHasPermission, threadIsChannel } from 'lib/shared/thread-utils';
import {
type ThreadInfo,
threadTypes,
@@ -64,9 +64,7 @@
);
const hasSubchannels = React.useMemo(() => {
- return childThreads?.some(
- childThreadInfo => childThreadInfo.type !== threadTypes.SIDEBAR,
- );
+ return !!childThreads?.some(threadIsChannel);
}, [childThreads]);
const viewSubchannelsItem = React.useMemo(() => {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 6:25 AM (20 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2516198
Default Alt Text
D3261.id9805.diff (2 KB)
Attached To
Mode
D3261: [web, native] Introduce and use `ThreadIsChannel` function
Attached
Detach File
Event Timeline
Log In to Comment