## Description Fixes a bug where the organization's `displayName` and `slug` fields were not being properly stored in the Redux state when fetching the current organization configuration. ## Changes - Added `displayName` and `slug` fields to the `FETCH_CURRENT_ORGANIZATION_CONFIG_SUCCESS` reducer handler - These fields were already defined in the `OrganizationReduxState` interface but were missing from the actual state update ## Automation /ok-to-test tags="@tag.Sanity" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/15286413781> > Commit: cca1886b0d8dd24a9193dab5a0a5a7a3c004cda2 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=15286413781&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Sanity` > Spec: > <hr>Tue, 27 May 2025 22:31:26 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Organization details now display additional information, including display name and slug, when viewing organization configuration. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
119 lines
3.8 KiB
TypeScript
119 lines
3.8 KiB
TypeScript
import type { ReduxAction } from "actions/ReduxActionTypes";
|
|
import {
|
|
ReduxActionErrorTypes,
|
|
ReduxActionTypes,
|
|
} from "ee/constants/ReduxActionConstants";
|
|
import {
|
|
APPSMITH_BRAND_FAVICON_URL,
|
|
APPSMITH_BRAND_LOGO_URL,
|
|
APPSMITH_BRAND_PRIMARY_COLOR,
|
|
createBrandColorsFromPrimaryColor,
|
|
} from "utils/BrandingUtils";
|
|
import { createReducer } from "utils/ReducerUtils";
|
|
|
|
export interface OrganizationReduxState<T> {
|
|
displayName?: string;
|
|
slug?: string;
|
|
userPermissions: string[];
|
|
organizationConfiguration: Record<string, T>;
|
|
new: boolean;
|
|
isLoading: boolean;
|
|
instanceId: string;
|
|
tenantId: string;
|
|
isWithinAnOrganization: boolean;
|
|
}
|
|
|
|
export const defaultBrandingConfig = {
|
|
brandFaviconUrl: APPSMITH_BRAND_FAVICON_URL,
|
|
brandColors: {
|
|
...createBrandColorsFromPrimaryColor(APPSMITH_BRAND_PRIMARY_COLOR),
|
|
},
|
|
brandLogoUrl: APPSMITH_BRAND_LOGO_URL,
|
|
};
|
|
|
|
// TODO: Fix this the next time the file is edited
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
export const initialState: OrganizationReduxState<any> = {
|
|
userPermissions: [],
|
|
organizationConfiguration: {
|
|
...defaultBrandingConfig,
|
|
},
|
|
new: false,
|
|
isLoading: true,
|
|
instanceId: "",
|
|
tenantId: "",
|
|
isWithinAnOrganization: false,
|
|
};
|
|
|
|
export const handlers = {
|
|
[ReduxActionTypes.FETCH_CURRENT_ORGANIZATION_CONFIG]: (
|
|
// TODO: Fix this the next time the file is edited
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
state: OrganizationReduxState<any>,
|
|
action: ReduxAction<{ isBackgroundRequest: boolean }>,
|
|
) => ({
|
|
...state,
|
|
isLoading: !action.payload.isBackgroundRequest,
|
|
}),
|
|
[ReduxActionTypes.FETCH_CURRENT_ORGANIZATION_CONFIG_SUCCESS]: (
|
|
// TODO: Fix this the next time the file is edited
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
state: OrganizationReduxState<any>,
|
|
// TODO: Fix this the next time the file is edited
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
action: ReduxAction<OrganizationReduxState<any>>,
|
|
) => ({
|
|
...state,
|
|
userPermissions: action.payload.userPermissions || [],
|
|
organizationConfiguration: {
|
|
...defaultBrandingConfig,
|
|
...state.organizationConfiguration,
|
|
...action.payload.organizationConfiguration,
|
|
brandColors: {
|
|
...defaultBrandingConfig.brandColors,
|
|
...action.payload.organizationConfiguration.brandColors,
|
|
},
|
|
},
|
|
displayName: action.payload.displayName,
|
|
slug: action.payload.slug,
|
|
isLoading: false,
|
|
instanceId: action.payload.instanceId,
|
|
tenantId: action.payload.tenantId,
|
|
isWithinAnOrganization: action.payload.isWithinAnOrganization,
|
|
}),
|
|
[ReduxActionErrorTypes.FETCH_CURRENT_ORGANIZATION_CONFIG_ERROR]: (
|
|
// TODO: Fix this the next time the file is edited
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
state: OrganizationReduxState<any>,
|
|
) => ({
|
|
...state,
|
|
isLoading: false,
|
|
}),
|
|
[ReduxActionTypes.UPDATE_ORGANIZATION_CONFIG_SUCCESS]: (
|
|
// TODO: Fix this the next time the file is edited
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
state: OrganizationReduxState<any>,
|
|
// TODO: Fix this the next time the file is edited
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
action: ReduxAction<OrganizationReduxState<any>>,
|
|
) => ({
|
|
...state,
|
|
...action.payload,
|
|
organizationConfiguration: {
|
|
...state.organizationConfiguration,
|
|
...action.payload.organizationConfiguration,
|
|
},
|
|
isLoading: false,
|
|
}),
|
|
[ReduxActionErrorTypes.UPDATE_ORGANIZATION_CONFIG_ERROR]: (
|
|
// TODO: Fix this the next time the file is edited
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
state: OrganizationReduxState<any>,
|
|
) => ({
|
|
...state,
|
|
isLoading: false,
|
|
}),
|
|
};
|
|
|
|
export default createReducer(initialState, handlers);
|