File tree Expand file tree Collapse file tree
packages/react-ui/src/app Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,9 +59,28 @@ export const flagsHooks = {
5959 } ;
6060 } ,
6161 useShouldFetchCloudTemplates : ( ) => {
62- return (
63- ! flagsHooks . useFlag < boolean > ( FlagId . CLOUD_CONNECTION_PAGE_ENABLED ) . data ||
64- false
65- ) ;
62+ const cloudConnectionPageEnabled = flagsHooks . useFlag < boolean > (
63+ FlagId . CLOUD_CONNECTION_PAGE_ENABLED ,
64+ ) . data ;
65+ const federatedLoginEnabled = flagsHooks . useFlag < boolean > (
66+ FlagId . FEDERATED_LOGIN_ENABLED ,
67+ ) . data ;
68+
69+ // Fetch cloud templates when cloud connection page is disabled
70+ // OR when federated login is enabled
71+ return ! cloudConnectionPageEnabled || federatedLoginEnabled || false ;
72+ } ,
73+
74+ useShouldShowCloudUserInMenu : ( ) => {
75+ const cloudConnectionPageEnabled = flagsHooks . useFlag < boolean > (
76+ FlagId . CLOUD_CONNECTION_PAGE_ENABLED ,
77+ ) . data ;
78+ const federatedLoginEnabled = flagsHooks . useFlag < boolean > (
79+ FlagId . FEDERATED_LOGIN_ENABLED ,
80+ ) . data ;
81+
82+ // Show cloud user in menu only when:
83+ // - Cloud connection page is disabled AND federated login is also disabled
84+ return ! cloudConnectionPageEnabled && ! federatedLoginEnabled ;
6685 } ,
6786} ;
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ const SideMenuFooter = ({ isMinimized }: Props) => {
3838 } ) ) ;
3939 const user = authenticationSession . getCurrentUser ( ) ;
4040 const useCloudTemplates = flagsHooks . useShouldFetchCloudTemplates ( ) ;
41+ const shouldShowCloudUserInMenu = flagsHooks . useShouldShowCloudUserInMenu ( ) ;
4142 const branding = flagsHooks . useWebsiteBranding ( ) ;
4243 const { createPollingInterval } = useUserInfoPolling ( ) ;
4344
@@ -103,12 +104,13 @@ const SideMenuFooter = ({ isMinimized }: Props) => {
103104 onLogout = { onLogout }
104105 isMinimized = { isMinimized }
105106 cloudConfig = { {
106- user : cloudUser
107- ? {
108- email : cloudUser . email ,
109- }
110- : undefined ,
111- isCloudLoginEnabled : useCloudTemplates ,
107+ user :
108+ cloudUser && shouldShowCloudUserInMenu
109+ ? {
110+ email : cloudUser . email ,
111+ }
112+ : undefined ,
113+ isCloudLoginEnabled : useCloudTemplates && shouldShowCloudUserInMenu ,
112114 onCloudLogin,
113115 logoUrl : branding . logos . logoIconPositiveUrl ,
114116 } }
You can’t perform that action at this time.
0 commit comments