Skip to content

Commit f2c60a6

Browse files
author
MargeBot
committed
Merge branch 'p1-byoe' into 'main'
Do not show BYOE to sub users See merge request web/clients!16907
2 parents 3ae7e4d + 4f2f696 commit f2c60a6

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

packages/activation/src/components/Modals/ReachedLimitForwardingModal/ReachedLimitForwardingModal.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { c, msgid } from 'ttag';
22

3+
import { useUser } from '@proton/account/user/hooks';
34
import { MAX_SYNC_PAID_USER } from '@proton/activation/src/constants';
45
import { Button } from '@proton/atoms';
56
import { Prompt } from '@proton/components';
67
import type { ModalStateProps } from '@proton/components/components/modalTwo/useModalState';
8+
import { isAdmin } from '@proton/shared/lib/user/helpers';
79
import { useFlag } from '@proton/unleash/index';
810

911
const getModalText = (hasAccessToBYOE: boolean) => {
@@ -27,7 +29,9 @@ const getModalText = (hasAccessToBYOE: boolean) => {
2729
interface Props extends ModalStateProps {}
2830

2931
const ReachedLimitForwardingModal = ({ ...rest }: Props) => {
30-
const hasAccessToBYOE = useFlag('InboxBringYourOwnEmail');
32+
const [user] = useUser();
33+
// Only admins can access to BYOE for now, this will change later
34+
const hasAccessToBYOE = useFlag('InboxBringYourOwnEmail') && isAdmin(user);
3135

3236
return (
3337
<Prompt

packages/activation/src/components/SettingsArea/GmailForwarding.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { c } from 'ttag';
22

3+
import { useUser } from '@proton/account/user/hooks';
34
import ConnectGmailButton from '@proton/activation/src/components/SettingsArea/ConnectGmailButton';
45
import { type APP_NAMES, MAIL_APP_NAME } from '@proton/shared/lib/constants';
6+
import { isAdmin } from '@proton/shared/lib/user/helpers';
57
import { useFlag } from '@proton/unleash';
68

79
const getFeatureDescription = (hasAccessToBYOE: boolean) => {
@@ -26,7 +28,9 @@ interface Props {
2628
}
2729

2830
const GmailForwarding = ({ app }: Props) => {
29-
const hasAccessToBYOE = useFlag('InboxBringYourOwnEmail');
31+
const [user] = useUser();
32+
// Only admins can access to BYOE for now, this will change later
33+
const hasAccessToBYOE = useFlag('InboxBringYourOwnEmail') && isAdmin(user);
3034

3135
return (
3236
<>

packages/activation/src/hooks/useSetupGmailBYOEAddress.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useEffect } from 'react';
33
import { c } from 'ttag';
44

55
import { createBYOEAddress } from '@proton/account/addresses/actions';
6+
import { useUser } from '@proton/account/user/hooks';
67
import {
78
G_OAUTH_SCOPE_DEFAULT,
89
G_OAUTH_SCOPE_MAIL_FULL_SCOPE,
@@ -16,10 +17,13 @@ import { getAllSync } from '@proton/activation/src/logic/sync/sync.selectors';
1617
import useNotifications from '@proton/components/hooks/useNotifications';
1718
import { useDispatch } from '@proton/redux-shared-store/sharedProvider';
1819
import { getEmailParts } from '@proton/shared/lib/helpers/email';
20+
import { isAdmin } from '@proton/shared/lib/user/helpers';
1921
import { useFlag } from '@proton/unleash/index';
2022

2123
const useSetupGmailBYOEAddress = () => {
22-
const hasAccessToBYOE = useFlag('InboxBringYourOwnEmail');
24+
const [user] = useUser();
25+
// Only admins can access to BYOE for now, this will change later
26+
const hasAccessToBYOE = useFlag('InboxBringYourOwnEmail') && isAdmin(user);
2327
const isInMaintenance = useFlag('MaintenanceImporter');
2428
const easySwitchDispatch = useEasySwitchDispatch();
2529
const allSyncs = useEasySwitchSelector(getAllSync);

packages/components/containers/addresses/AddressesSection.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { useOrganization } from '@proton/account/organization/hooks';
2+
import { useUser } from '@proton/account/user/hooks';
23
import Loader from '@proton/components/components/loader/Loader';
34
import SettingsSectionWide from '@proton/components/containers/account/SettingsSectionWide';
5+
import { isAdmin } from '@proton/shared/lib/user/helpers';
46
import { useFlag } from '@proton/unleash/index';
57

68
import Addresses from './Addresses';
@@ -10,8 +12,10 @@ interface Props {
1012
}
1113

1214
const AddressesSection = ({ isOnlySelf }: Props) => {
15+
const [user] = useUser();
1316
const [organization, loadingOrganization] = useOrganization();
14-
const hasAccessToBYOE = useFlag('InboxBringYourOwnEmail');
17+
// Only admins can access to BYOE for now, this will change later
18+
const hasAccessToBYOE = useFlag('InboxBringYourOwnEmail') && isAdmin(user);
1519

1620
return (
1721
<SettingsSectionWide>

0 commit comments

Comments
 (0)