diff --git a/webapp/channels/src/components/root/index.ts b/webapp/channels/src/components/root/index.ts index fc198be339..6f69ef20e6 100644 --- a/webapp/channels/src/components/root/index.ts +++ b/webapp/channels/src/components/root/index.ts @@ -11,7 +11,7 @@ import type {Dispatch} from 'redux'; import {getFirstAdminSetupComplete, getCustomProfileAttributeFields} from 'mattermost-redux/actions/general'; import {getProfiles} from 'mattermost-redux/actions/users'; import {isCurrentLicenseCloud} from 'mattermost-redux/selectors/entities/cloud'; -import {getConfig} from 'mattermost-redux/selectors/entities/general'; +import {getConfig, getFeatureFlagValue} from 'mattermost-redux/selectors/entities/general'; import {getTheme} from 'mattermost-redux/selectors/entities/preferences'; import {getTeam} from 'mattermost-redux/selectors/entities/teams'; import {shouldShowTermsOfService, getCurrentUserId} from 'mattermost-redux/selectors/entities/users'; @@ -74,6 +74,7 @@ function mapStateToProps(state: GlobalState) { shouldShowAppBar: shouldShowAppBar(state), isCloud: isCurrentLicenseCloud(state), isDevModeEnabled: isDevModeEnabled(state), + customProfileAttributesEnabled: getFeatureFlagValue(state, 'CustomProfileAttributes') === 'true', }; } diff --git a/webapp/channels/src/components/root/root.test.tsx b/webapp/channels/src/components/root/root.test.tsx index 7f9df3acbc..8a7be9351d 100644 --- a/webapp/channels/src/components/root/root.test.tsx +++ b/webapp/channels/src/components/root/root.test.tsx @@ -88,6 +88,7 @@ describe('components/Root', () => { shouldShowAppBar: false, isCloud: false, enableDesktopLandingPage: true, + customProfileAttributesEnabled: false, actions: { loadConfigAndMe: jest.fn().mockImplementation(() => { return Promise.resolve({ diff --git a/webapp/channels/src/components/root/root.tsx b/webapp/channels/src/components/root/root.tsx index 2a9b701439..be9d4cefc3 100644 --- a/webapp/channels/src/components/root/root.tsx +++ b/webapp/channels/src/components/root/root.tsx @@ -84,7 +84,9 @@ const Pluggable = makeAsyncPluggableComponent(); const noop = () => {}; -export type Props = PropsFromRedux & RouteComponentProps; +export type Props = PropsFromRedux & RouteComponentProps & { + customProfileAttributesEnabled?: boolean; +} interface State { shouldMountAppRoutes?: boolean; @@ -185,8 +187,6 @@ export default class Root extends React.PureComponent { this.props.actions.migrateRecentEmojis(); this.props.actions.loadRecentlyUsedCustomEmojis(); - this.props.actions.getCustomProfileAttributeFields(); - this.showLandingPageIfNecessary(); this.applyTheme(); @@ -286,6 +286,9 @@ export default class Root extends React.PureComponent { if (!prevProps.isConfigLoaded && this.props.isConfigLoaded) { this.setRudderConfig(); + if (this.props.customProfileAttributesEnabled) { + this.props.actions.getCustomProfileAttributeFields(); + } } if (prevState.shouldMountAppRoutes === false && this.state.shouldMountAppRoutes === true) {