Page MenuHomePhabricator

D3261.id9805.diff
No OneTemporary

D3261.id9805.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
@@ -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

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)

Event Timeline