Просмотр исходного кода

Merge pull request #18422 from overleaf/rh-managed-acct-delete-email

[web]: Clarify tooltip for managed user attempting to delete email address

GitOrigin-RevId: 82eabc0b9d96773d5d418bec52ea917fd585ec63
roo hutton 2 лет назад
Родитель
Сommit
5aea030184

+ 1 - 0
services/web/frontend/extracted-translations.json

@@ -1589,6 +1589,7 @@
   "youll_need_to_ask_the_github_repository_owner": "",
   "youll_need_to_ask_the_github_repository_owner": "",
   "youll_no_longer_need_to_remember_credentials": "",
   "youll_no_longer_need_to_remember_credentials": "",
   "your_account_is_managed_by_admin_cant_join_additional_group": "",
   "your_account_is_managed_by_admin_cant_join_additional_group": "",
+  "your_account_is_managed_by_your_group_admin": "",
   "your_affiliation_is_confirmed": "",
   "your_affiliation_is_confirmed": "",
   "your_browser_does_not_support_this_feature": "",
   "your_browser_does_not_support_this_feature": "",
   "your_compile_timed_out": "",
   "your_compile_timed_out": "",

+ 12 - 5
services/web/frontend/js/features/settings/components/emails/actions/remove.tsx

@@ -8,6 +8,7 @@ import OLIconButton, {
   OLIconButtonProps,
   OLIconButtonProps,
 } from '@/features/ui/components/ol/ol-icon-button'
 } from '@/features/ui/components/ol/ol-icon-button'
 import { bsVersion } from '@/features/utils/bootstrap-5'
 import { bsVersion } from '@/features/utils/bootstrap-5'
+import getMeta from '@/utils/meta'
 
 
 type DeleteButtonProps = Pick<
 type DeleteButtonProps = Pick<
   OLIconButtonProps,
   OLIconButtonProps,
@@ -45,6 +46,16 @@ function Remove({ userEmailData, deleteEmailAsync }: RemoveProps) {
   const { t } = useTranslation()
   const { t } = useTranslation()
   const { state, deleteEmail, resetLeaversSurveyExpiration } =
   const { state, deleteEmail, resetLeaversSurveyExpiration } =
     useUserEmailsContext()
     useUserEmailsContext()
+  const isManaged = getMeta('ol-isManagedAccount', false)
+
+  const getTooltipText = () => {
+    if (isManaged) {
+      return t('your_account_is_managed_by_your_group_admin')
+    }
+    return userEmailData.default
+      ? t('please_change_primary_to_remove')
+      : t('remove')
+  }
 
 
   const handleRemoveUserEmail = () => {
   const handleRemoveUserEmail = () => {
     deleteEmailAsync
     deleteEmailAsync
@@ -69,11 +80,7 @@ function Remove({ userEmailData, deleteEmailAsync }: RemoveProps) {
   return (
   return (
     <OLTooltip
     <OLTooltip
       id={userEmailData.email}
       id={userEmailData.email}
-      description={
-        userEmailData.default
-          ? t('please_change_primary_to_remove')
-          : t('remove')
-      }
+      description={getTooltipText()}
       overlayProps={{ placement: userEmailData.default ? 'left' : 'top' }}
       overlayProps={{ placement: userEmailData.default ? 'left' : 'top' }}
     >
     >
       <span>
       <span>

+ 1 - 0
services/web/locales/en.json

@@ -2217,6 +2217,7 @@
   "youll_need_to_ask_the_github_repository_owner": "You’ll need to ask the GitHub repository owner (<0>__repoOwnerEmail__</0>) to reconnect the project.",
   "youll_need_to_ask_the_github_repository_owner": "You’ll need to ask the GitHub repository owner (<0>__repoOwnerEmail__</0>) to reconnect the project.",
   "youll_no_longer_need_to_remember_credentials": "You’ll no longer need to remember a separate email address and password. Instead, you will use single-sign on to login to Overleaf. <0>Read more about SSO</0>.",
   "youll_no_longer_need_to_remember_credentials": "You’ll no longer need to remember a separate email address and password. Instead, you will use single-sign on to login to Overleaf. <0>Read more about SSO</0>.",
   "your_account_is_managed_by_admin_cant_join_additional_group": "Your __appName__ account is managed by your current group admin (__admin__). This means you can’t join additional group subscriptions. <0>Read more about Managed Users.</0>",
   "your_account_is_managed_by_admin_cant_join_additional_group": "Your __appName__ account is managed by your current group admin (__admin__). This means you can’t join additional group subscriptions. <0>Read more about Managed Users.</0>",
+  "your_account_is_managed_by_your_group_admin": "Your account is managed by your group admin. You can’t change or delete your email address.",
   "your_account_is_suspended": "Your account is suspended",
   "your_account_is_suspended": "Your account is suspended",
   "your_affiliation_is_confirmed": "Your <0>__institutionName__</0> affiliation is confirmed.",
   "your_affiliation_is_confirmed": "Your <0>__institutionName__</0> affiliation is confirmed.",
   "your_browser_does_not_support_this_feature": "Sorry, your browser doesn’t support this feature. Please update your browser to its latest version.",
   "your_browser_does_not_support_this_feature": "Sorry, your browser doesn’t support this feature. Please update your browser to its latest version.",