♻️(features) rename "TEAMS" flag

To match recent changes we rename the "TEAMS" feature flag
to "TEAMS_DISPLAY".
This commit is contained in:
Quentin BEY
2024-11-14 14:20:10 +01:00
committed by BEY Quentin
parent 59f3499799
commit 90a3e26c7f
12 changed files with 38 additions and 18 deletions

View File

@@ -487,7 +487,7 @@ class User(AbstractBaseUser, BaseModel, auth_models.PermissionsMixin):
), ),
}, },
"teams": { "teams": {
"can_view": teams_can_view and settings.FEATURES["TEAMS"], "can_view": teams_can_view and settings.FEATURES["TEAMS_DISPLAY"],
"can_create": teams_can_view and settings.FEATURES["TEAMS_CREATE"], "can_create": teams_can_view and settings.FEATURES["TEAMS_CREATE"],
}, },
"mailboxes": { "mailboxes": {

View File

@@ -24,7 +24,7 @@ def test_api_config_anonymous():
"CONTACTS_DISPLAY": True, "CONTACTS_DISPLAY": True,
"CONTACTS_CREATE": True, "CONTACTS_CREATE": True,
"MAILBOXES_CREATE": True, "MAILBOXES_CREATE": True,
"TEAMS": True, "TEAMS_DISPLAY": True,
"TEAMS_CREATE": True, "TEAMS_CREATE": True,
}, },
"RELEASE": "NA", "RELEASE": "NA",
@@ -46,7 +46,7 @@ def test_api_config_authenticated():
"CONTACTS_DISPLAY": True, "CONTACTS_DISPLAY": True,
"CONTACTS_CREATE": True, "CONTACTS_CREATE": True,
"MAILBOXES_CREATE": True, "MAILBOXES_CREATE": True,
"TEAMS": True, "TEAMS_DISPLAY": True,
"TEAMS_CREATE": True, "TEAMS_CREATE": True,
}, },
"RELEASE": "NA", "RELEASE": "NA",

View File

@@ -465,7 +465,7 @@ class Base(Configuration):
"CONTACTS_CREATE", # Used in the users/me/ endpoint "CONTACTS_CREATE", # Used in the users/me/ endpoint
"CONTACTS_DISPLAY", # Used in the users/me/ endpoint "CONTACTS_DISPLAY", # Used in the users/me/ endpoint
"MAILBOXES_CREATE", # Used in the users/me/ endpoint "MAILBOXES_CREATE", # Used in the users/me/ endpoint
"TEAMS", "TEAMS_DISPLAY",
"TEAMS_CREATE", # Used in the users/me/ endpoint "TEAMS_CREATE", # Used in the users/me/ endpoint
} }

View File

@@ -21,7 +21,11 @@ describe('Page', () => {
it('checks Page rendering with team feature', () => { it('checks Page rendering with team feature', () => {
useConfigStore.setState({ useConfigStore.setState({
config: { RELEASE: '1.0.0', FEATURES: { TEAMS: true }, LANGUAGES: [] }, config: {
RELEASE: '1.0.0',
FEATURES: { TEAMS_DISPLAY: true },
LANGUAGES: [],
},
}); });
render(<Page />, { wrapper: AppWrapper }); render(<Page />, { wrapper: AppWrapper });
@@ -31,7 +35,11 @@ describe('Page', () => {
it('checks Page rendering without team feature', () => { it('checks Page rendering without team feature', () => {
useConfigStore.setState({ useConfigStore.setState({
config: { RELEASE: '1.0.0', FEATURES: { TEAMS: false }, LANGUAGES: [] }, config: {
RELEASE: '1.0.0',
FEATURES: { TEAMS_DISPLAY: false },
LANGUAGES: [],
},
}); });
render(<Page />, { wrapper: AppWrapper }); render(<Page />, { wrapper: AppWrapper });

View File

@@ -15,7 +15,7 @@ export function MainLayout({ children }: PropsWithChildren) {
<Box $height="100vh"> <Box $height="100vh">
<Header /> <Header />
<Box $css="flex: 1;" $direction="row"> <Box $css="flex: 1;" $direction="row">
{config?.FEATURES.TEAMS && <Menu />} {config?.FEATURES.TEAMS_DISPLAY && <Menu />}
<Box <Box
as="main" as="main"
$height={`calc(100vh - ${HEADER_HEIGHT})`} $height={`calc(100vh - ${HEADER_HEIGHT})`}

View File

@@ -18,7 +18,11 @@ jest.mock('next/navigation', () => ({
describe('MainLayout', () => { describe('MainLayout', () => {
it('checks menu rendering with team feature', () => { it('checks menu rendering with team feature', () => {
useConfigStore.setState({ useConfigStore.setState({
config: { RELEASE: '1.0.0', FEATURES: { TEAMS: true }, LANGUAGES: [] }, config: {
RELEASE: '1.0.0',
FEATURES: { TEAMS_DISPLAY: true },
LANGUAGES: [],
},
}); });
useAuthStore.setState({ useAuthStore.setState({
authenticated: true, authenticated: true,
@@ -51,7 +55,11 @@ describe('MainLayout', () => {
it('checks menu rendering with no abilities', () => { it('checks menu rendering with no abilities', () => {
useConfigStore.setState({ useConfigStore.setState({
config: { RELEASE: '1.0.0', FEATURES: { TEAMS: true }, LANGUAGES: [] }, config: {
RELEASE: '1.0.0',
FEATURES: { TEAMS_DISPLAY: true },
LANGUAGES: [],
},
}); });
useAuthStore.setState({ useAuthStore.setState({
authenticated: true, authenticated: true,
@@ -85,7 +93,11 @@ describe('MainLayout', () => {
it('checks menu rendering without team feature', () => { it('checks menu rendering without team feature', () => {
useConfigStore.setState({ useConfigStore.setState({
config: { RELEASE: '1.0.0', FEATURES: { TEAMS: false }, LANGUAGES: [] }, config: {
RELEASE: '1.0.0',
FEATURES: { TEAMS_DISPLAY: false },
LANGUAGES: [],
},
}); });
useAuthStore.setState({ useAuthStore.setState({
authenticated: true, authenticated: true,

View File

@@ -2,6 +2,6 @@ export interface Config {
LANGUAGES: [string, string][]; LANGUAGES: [string, string][];
RELEASE: string; RELEASE: string;
FEATURES: { FEATURES: {
TEAMS: boolean; TEAMS_DISPLAY: boolean;
}; };
} }

View File

@@ -22,7 +22,7 @@ export const Panel = () => {
$minWidth: '0', $minWidth: '0',
}; };
const styleNoTeam = !config?.FEATURES.TEAMS && { const styleNoTeam = !config?.FEATURES.TEAMS_DISPLAY && {
$display: 'none', $display: 'none',
tabIndex: -1, tabIndex: -1,
}; };

View File

@@ -9,8 +9,8 @@ const Page: NextPageWithLayout = () => {
const router = useNavigate(); const router = useNavigate();
useEffect(() => { useEffect(() => {
router.push(config?.FEATURES.TEAMS ? '/teams/' : '/mail-domains/'); router.push(config?.FEATURES.TEAMS_DISPLAY ? '/teams/' : '/mail-domains/');
}, [config?.FEATURES.TEAMS, router]); }, [config?.FEATURES.TEAMS_DISPLAY, router]);
return null; return null;
}; };

View File

@@ -25,7 +25,7 @@ test.describe('Config', () => {
CONTACTS_DISPLAY: true, CONTACTS_DISPLAY: true,
MAILBOXES_CREATE: true, MAILBOXES_CREATE: true,
TEAMS_CREATE: true, TEAMS_CREATE: true,
TEAMS: true, TEAMS_DISPLAY: true,
}, },
RELEASE: 'NA', RELEASE: 'NA',
}); });
@@ -48,7 +48,7 @@ test.describe('Config', () => {
['en-us', 'English'], ['en-us', 'English'],
['fr-fr', 'French'], ['fr-fr', 'French'],
], ],
FEATURES: { TEAMS: false }, FEATURES: { TEAMS_DISPLAY: false },
}, },
}); });
} else { } else {

View File

@@ -100,7 +100,7 @@ backend:
secretKeyRef: secretKeyRef:
name: backend name: backend
key: MAIL_PROVISIONING_API_CREDENTIALS key: MAIL_PROVISIONING_API_CREDENTIALS
FEATURE_TEAMS: False FEATURE_TEAMS_DISPLAY: False
FEATURE_CONTACTS_DISPLAY: False FEATURE_CONTACTS_DISPLAY: False
FEATURE_CONTACTS_CREATE: False FEATURE_CONTACTS_CREATE: False
FEATURE_TEAMS_CREATE: False FEATURE_TEAMS_CREATE: False

View File

@@ -100,7 +100,7 @@ backend:
secretKeyRef: secretKeyRef:
name: backend name: backend
key: MAIL_PROVISIONING_API_CREDENTIALS key: MAIL_PROVISIONING_API_CREDENTIALS
FEATURE_TEAMS: False FEATURE_TEAMS_DISPLAY: False
FEATURE_CONTACTS_DISPLAY: False FEATURE_CONTACTS_DISPLAY: False
FEATURE_CONTACTS_CREATE: False FEATURE_CONTACTS_CREATE: False
FEATURE_TEAMS_CREATE: False FEATURE_TEAMS_CREATE: False