MM-63387 Check Feature flag before custom field retrieval (#30574)

* check feature flag before attempting to retrieve fields

* add property to test

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Scott Bishel
2025-03-31 08:25:22 -06:00
коммит произвёл GitHub
родитель f076e18eba
Коммит 1f0a180386
3 изменённых файлов: 9 добавлений и 4 удалений

Просмотреть файл

@@ -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',
};
}

Просмотреть файл

@@ -88,6 +88,7 @@ describe('components/Root', () => {
shouldShowAppBar: false,
isCloud: false,
enableDesktopLandingPage: true,
customProfileAttributesEnabled: false,
actions: {
loadConfigAndMe: jest.fn().mockImplementation(() => {
return Promise.resolve({

Просмотреть файл

@@ -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<Props, State> {
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<Props, State> {
if (!prevProps.isConfigLoaded && this.props.isConfigLoaded) {
this.setRudderConfig();
if (this.props.customProfileAttributesEnabled) {
this.props.actions.getCustomProfileAttributeFields();
}
}
if (prevState.shouldMountAppRoutes === false && this.state.shouldMountAppRoutes === true) {