Page MenuHomePhabricator

D3261.diff
No OneTemporary

D3261.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
@@ -141,11 +141,11 @@
}
function threadIsTopLevel(threadInfo: ?(ThreadInfo | RawThreadInfo)): boolean {
- return !!(
- threadInChatList(threadInfo) &&
- threadInfo &&
- threadInfo.type !== threadTypes.SIDEBAR
- );
+ return threadInChatList(threadInfo) && threadIsChannel(threadInfo);
+}
+
+function threadIsChannel(threadInfo: ?(ThreadInfo | RawThreadInfo)): boolean {
+ return !!(threadInfo && threadInfo.type !== threadTypes.SIDEBAR);
}
function threadInBackgroundChatList(
@@ -1274,6 +1274,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
@@ -12,7 +12,11 @@
import * as React from 'react';
import { childThreadInfos } from 'lib/selectors/thread-selectors';
-import { threadHasPermission, viewerIsMember } from 'lib/shared/thread-utils';
+import {
+ threadHasPermission,
+ viewerIsMember,
+ threadIsChannel,
+} from 'lib/shared/thread-utils';
import {
type ThreadInfo,
threadTypes,
@@ -65,9 +69,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
Tue, Dec 24, 7:04 PM (8 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2700845
Default Alt Text
D3261.diff (2 KB)

Event Timeline