From 6cf1bb447b990ecb20c467a18b9c3d6ec7feab2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Espino=20Garc=C3=ADa?= Date: Mon, 3 Nov 2025 12:36:29 +0100 Subject: [PATCH] [MM-66380] Only show playbook runs if enabled (#9252) --- .../categories_list/categories_list.tsx | 8 ++++- .../categories_list/index.test.tsx | 30 +++++++++++++++++++ .../channel_list/categories_list/index.tsx | 3 ++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/app/screens/home/channel_list/categories_list/categories_list.tsx b/app/screens/home/channel_list/categories_list/categories_list.tsx index 121c1e859..94f9db22d 100644 --- a/app/screens/home/channel_list/categories_list/categories_list.tsx +++ b/app/screens/home/channel_list/categories_list/categories_list.tsx @@ -38,6 +38,7 @@ type ChannelListProps = { scheduledPostHasError: boolean; lastChannelId?: string; scheduledPostsEnabled?: boolean; + playbooksEnabled?: boolean; }; const getTabletWidth = (moreThanOneTeam: boolean) => { @@ -56,6 +57,7 @@ const CategoriesList = ({ scheduledPostHasError, lastChannelId, scheduledPostsEnabled, + playbooksEnabled, }: ChannelListProps) => { const theme = useTheme(); const styles = getStyleSheet(theme); @@ -126,10 +128,14 @@ const CategoriesList = ({ }, [activeScreen, draftsCount, isTablet, scheduledPostCount, scheduledPostHasError, scheduledPostsEnabled]); const playbooksButtonComponent = useMemo(() => { + if (!playbooksEnabled) { + return null; + } + return ( ); - }, []); + }, [playbooksEnabled]); const content = useMemo(() => { if (!hasChannels) { diff --git a/app/screens/home/channel_list/categories_list/index.test.tsx b/app/screens/home/channel_list/categories_list/index.test.tsx index 7a6f11785..f7007fd09 100644 --- a/app/screens/home/channel_list/categories_list/index.test.tsx +++ b/app/screens/home/channel_list/categories_list/index.test.tsx @@ -170,4 +170,34 @@ describe('components/categories_list', () => { ); expect(wrapper.queryByText('Drafts')).not.toBeTruthy(); }); + + it('should not render channel list with Playbooks menu if playbooks feature is disabled', () => { + const wrapper = renderWithEverything( + , + {database}, + ); + expect(wrapper.queryByText('Playbook runs')).not.toBeTruthy(); + }); + + it('should render channel list with Playbooks menu if playbooks feature is enabled', () => { + const wrapper = renderWithEverything( + , + {database}, + ); + expect(wrapper.getByText('Playbook runs')).toBeTruthy(); + }); }); diff --git a/app/screens/home/channel_list/categories_list/index.tsx b/app/screens/home/channel_list/categories_list/index.tsx index c09089c49..3037c8a3e 100644 --- a/app/screens/home/channel_list/categories_list/index.tsx +++ b/app/screens/home/channel_list/categories_list/index.tsx @@ -5,6 +5,7 @@ import {withDatabase, withObservables} from '@nozbe/watermelondb/react'; import {of} from 'rxjs'; import {switchMap} from 'rxjs/operators'; +import {observeIsPlaybooksEnabled} from '@playbooks/database/queries/version'; import {observeDraftCount} from '@queries/servers/drafts'; import {observeScheduledPostEnabled, observeScheduledPostsForTeam} from '@queries/servers/scheduled_post'; import {observeCurrentTeamId} from '@queries/servers/system'; @@ -27,6 +28,7 @@ const enchanced = withObservables([], ({database}: WithDatabaseArgs) => { switchMap((scheduledPosts) => of(hasScheduledPostError(scheduledPosts))), ); const scheduledPostsEnabled = observeScheduledPostEnabled(database); + const playbooksEnabled = observeIsPlaybooksEnabled(database); return { lastChannelId, @@ -34,6 +36,7 @@ const enchanced = withObservables([], ({database}: WithDatabaseArgs) => { scheduledPostCount, scheduledPostHasError, scheduledPostsEnabled, + playbooksEnabled, }; });