diff --git a/frontend/src/admin/SuperAdminUserList.js b/frontend/src/admin/SuperAdminUserList.js
index d5485292cf..0f24ad3cd3 100644
--- a/frontend/src/admin/SuperAdminUserList.js
+++ b/frontend/src/admin/SuperAdminUserList.js
@@ -148,7 +148,7 @@ export function SuperAdminUserList({ permission }) {
{ value: 'USER_USERNAME', text: t`Email` },
{ value: 'USER_DISPLAYNAME', text: t`Display Name` },
{ value: 'USER_EMAIL_VALIDATED', text: t`Verified` },
- { value: 'USER_INSIDER', text: t`Insider` },
+ { value: 'USER_INSIDER', text: t`Inside User` },
]
const userList =
@@ -340,15 +340,17 @@ export function SuperAdminUserList({ permission }) {
>
Verified
-
- Insider
-
+ {insideUser && (
+
+ Inside User
+
+ )}
Affiliations: {totalCount}
diff --git a/frontend/src/admin/__tests__/AdminDomainCard.test.js b/frontend/src/admin/__tests__/AdminDomainCard.test.js
index 528017800d..42d1eeb1ae 100644
--- a/frontend/src/admin/__tests__/AdminDomainCard.test.js
+++ b/frontend/src/admin/__tests__/AdminDomainCard.test.js
@@ -6,6 +6,8 @@ import { I18nProvider } from '@lingui/react'
import { setupI18n } from '@lingui/core'
import { AdminDomainCard } from '../AdminDomainCard'
+import { MockedProvider } from '@apollo/client/testing'
+import { IS_USER_SUPER_ADMIN } from '../../graphql/queries'
const i18n = setupI18n({
locale: 'en',
@@ -17,21 +19,33 @@ const i18n = setupI18n({
},
})
+const mocks = [
+ {
+ request: {
+ query: IS_USER_SUPER_ADMIN,
+ },
+ result: {
+ data: {
+ isUserSuperAdmin: false,
+ },
+ },
+ },
+]
+
describe('', () => {
it('represents a domain', async () => {
const { getByText } = render(
-
-
-
-
-
-
-
-
- ,
+
+
+
+
+
+
+
+
+
+
+ ,
)
await waitFor(() => {
diff --git a/frontend/src/app/ABTestWrapper.js b/frontend/src/app/ABTestWrapper.js
index 8b5e8dcd9f..b7be0c8314 100644
--- a/frontend/src/app/ABTestWrapper.js
+++ b/frontend/src/app/ABTestWrapper.js
@@ -1,9 +1,11 @@
import React from 'react'
import { any, string } from 'prop-types'
import { useUserVar } from '../utilities/userState'
+import { IS_USER_SUPER_ADMIN } from '../graphql/queries'
+import { useQuery } from '@apollo/client'
-const isInsiderUser = ({ userName, insideUser }) => {
- return userName.endsWith('@tbs-sct.gc.ca') || insideUser
+const isInsiderUser = ({ isUserSuperAdmin, insideUser }) => {
+ return insideUser || isUserSuperAdmin
}
export function ABTestVariant({ children }) {
@@ -11,6 +13,7 @@ export function ABTestVariant({ children }) {
}
export function ABTestingWrapper({ children, insiderVariantName = 'B' }) {
+ const { data } = useQuery(IS_USER_SUPER_ADMIN)
const { currentUser } = useUserVar()
let childIndex = 0
@@ -18,7 +21,7 @@ export function ABTestingWrapper({ children, insiderVariantName = 'B' }) {
if (!children.length) {
if (
isInsiderUser({
- userName: currentUser?.userName || '',
+ isUserSuperAdmin: data?.isUserSuperAdmin || false,
insideUser: currentUser?.insideUser || false,
})
) {
@@ -32,7 +35,7 @@ export function ABTestingWrapper({ children, insiderVariantName = 'B' }) {
// A + B variants
if (
isInsiderUser({
- userName: currentUser?.userName || '',
+ isUserSuperAdmin: data?.isUserSuperAdmin || false,
insideUser: currentUser?.insideUser || false,
})
) {
diff --git a/frontend/src/locales/en.po b/frontend/src/locales/en.po
index 160e701081..12a4807d4a 100644
--- a/frontend/src/locales/en.po
+++ b/frontend/src/locales/en.po
@@ -261,8 +261,12 @@ msgid "An error occurred while updating your email address."
msgstr "An error occurred while updating your email address."
#: src/user/InsideUserSwitch.js:19
-msgid "An error occurred while updating your insider preference."
-msgstr "An error occurred while updating your insider preference."
+msgid "An error occurred while updating your inside user preference."
+msgstr "An error occurred while updating your inside user preference."
+
+#: src/user/InsideUserSwitch.js:19
+#~ msgid "An error occurred while updating your insider preference."
+#~ msgstr "An error occurred while updating your insider preference."
#: src/user/EditableUserLanguage.js:20
msgid "An error occurred while updating your language."
@@ -411,7 +415,7 @@ msgstr "By default our scanners check domains ending in “.gc.ca” and “.can
msgid "Canadians rely on the Government of Canada to provide secure digital services. The Policy on Service and Digital guides government online services to adopt good security practices for practices outlined in the <0>email0> and <1>web1> services. Track how government sites are becoming more secure."
msgstr "Canadians rely on the Government of Canada to provide secure digital services. The Policy on Service and Digital guides government online services to adopt good security practices for practices outlined in the <0>email0> and <1>web1> services. Track how government sites are becoming more secure."
-#: src/admin/SuperAdminUserList.js:432
+#: src/admin/SuperAdminUserList.js:434
#: src/user/UserPage.js:289
msgid "Cancel"
msgstr "Cancel"
@@ -513,8 +517,8 @@ msgstr "Clear"
msgid "Close"
msgstr "Close"
-#: src/admin/SuperAdminUserList.js:369
-#: src/admin/SuperAdminUserList.js:402
+#: src/admin/SuperAdminUserList.js:371
+#: src/admin/SuperAdminUserList.js:404
#: src/user/UserPage.js:229
#: src/user/UserPage.js:260
msgid "Close Account"
@@ -1154,7 +1158,7 @@ msgid "English"
msgstr "English"
#: src/admin/OrganizationInformation.js:501
-#: src/admin/SuperAdminUserList.js:413
+#: src/admin/SuperAdminUserList.js:415
msgid "Enter \"{0}\" below to confirm removal. This field is case-sensitive."
msgstr "Enter \"{0}\" below to confirm removal. This field is case-sensitive."
@@ -1814,18 +1818,23 @@ msgstr "Informative tags highlight relevant configuration details, but are not a
msgid "Initiated By"
msgstr "Initiated By"
-#: src/user/InsideUserSwitch.js:83
-#~ msgid "Inside User"
-#~ msgstr "Inside User"
+#: src/admin/SuperAdminUserList.js:151
+#: src/admin/SuperAdminUserList.js:351
+msgid "Inside User"
+msgstr "Inside User"
+
+#: src/user/InsideUserSwitch.js:31
+msgid "Inside user status changed"
+msgstr "Inside user status changed"
#: src/admin/SuperAdminUserList.js:151
#: src/admin/SuperAdminUserList.js:350
-msgid "Insider"
-msgstr "Insider"
+#~ msgid "Insider"
+#~ msgstr "Insider"
#: src/user/InsideUserSwitch.js:31
-msgid "Insider status changed"
-msgstr "Insider status changed"
+#~ msgid "Insider status changed"
+#~ msgstr "Insider status changed"
#: src/termsConditions/TermsConditionsPage.js:132
msgid "Intellectual Property, Copyright and Trademarks"
@@ -2890,7 +2899,7 @@ msgstr "Search for a domain"
msgid "Search for a tagged organization"
msgstr "Search for a tagged organization"
-#: src/admin/SuperAdminUserList.js:471
+#: src/admin/SuperAdminUserList.js:473
msgid "Search for a user (email)"
msgstr "Search for a user (email)"
@@ -3416,7 +3425,7 @@ msgstr "These metrics are an important first step in securing your services and
msgid "These terms and conditions shall be governed by and interpreted under the laws of Canada, without regard for any choice of law rules. The courts of Canada shall have exclusive jurisdiction over all matters arising in relation to these terms and conditions."
msgstr "These terms and conditions shall be governed by and interpreted under the laws of Canada, without regard for any choice of law rules. The courts of Canada shall have exclusive jurisdiction over all matters arising in relation to these terms and conditions."
-#: src/admin/SuperAdminUserList.js:406
+#: src/admin/SuperAdminUserList.js:408
msgid "This action CANNOT be reversed, are you sure you wish to to close the account {0}?"
msgstr "This action CANNOT be reversed, are you sure you wish to to close the account {0}?"
@@ -3670,8 +3679,12 @@ msgid "Unable to update to your display name, please try again."
msgstr "Unable to update to your display name, please try again."
#: src/user/InsideUserSwitch.js:46
-msgid "Unable to update to your insider status, please try again."
-msgstr "Unable to update to your insider status, please try again."
+msgid "Unable to update to your inside user status, please try again."
+msgstr "Unable to update to your inside user status, please try again."
+
+#: src/user/InsideUserSwitch.js:46
+#~ msgid "Unable to update to your insider status, please try again."
+#~ msgstr "Unable to update to your insider status, please try again."
#: src/user/EditableUserLanguage.js:42
msgid "Unable to update to your preferred language, please try again."
@@ -3764,7 +3777,7 @@ msgstr "User"
msgid "User Affiliations"
msgstr "User Affiliations"
-#: src/admin/SuperAdminUserList.js:421
+#: src/admin/SuperAdminUserList.js:423
#: src/user/UserPage.js:278
msgid "User Email"
msgstr "User Email"
@@ -4070,8 +4083,12 @@ msgid "You have successfully updated your email."
msgstr "You have successfully updated your email."
#: src/user/InsideUserSwitch.js:32
-msgid "You have successfully updated your insider preference."
-msgstr "You have successfully updated your insider preference."
+msgid "You have successfully updated your inside user preference."
+msgstr "You have successfully updated your inside user preference."
+
+#: src/user/InsideUserSwitch.js:32
+#~ msgid "You have successfully updated your insider preference."
+#~ msgstr "You have successfully updated your insider preference."
#: src/user/EditableUserPassword.js:55
msgid "You have successfully updated your password."
diff --git a/frontend/src/locales/fr.po b/frontend/src/locales/fr.po
index 65f155fba8..675cdd24be 100644
--- a/frontend/src/locales/fr.po
+++ b/frontend/src/locales/fr.po
@@ -261,8 +261,12 @@ msgid "An error occurred while updating your email address."
msgstr "Une erreur s'est produite lors de la mise à jour de votre adresse électronique."
#: src/user/InsideUserSwitch.js:19
-msgid "An error occurred while updating your insider preference."
-msgstr "Une erreur s'est produite lors de la mise à jour de vos préférences d'initié."
+msgid "An error occurred while updating your inside user preference."
+msgstr "Une erreur s'est produite lors de la mise à jour de vos préférences d'utilisateur interne."
+
+#: src/user/InsideUserSwitch.js:19
+#~ msgid "An error occurred while updating your insider preference."
+#~ msgstr "Une erreur s'est produite lors de la mise à jour de vos préférences d'initié."
#: src/user/EditableUserLanguage.js:20
msgid "An error occurred while updating your language."
@@ -411,7 +415,7 @@ msgstr "Par défaut, nos scanners vérifient les domaines se terminant par \".gc
msgid "Canadians rely on the Government of Canada to provide secure digital services. The Policy on Service and Digital guides government online services to adopt good security practices for practices outlined in the <0>email0> and <1>web1> services. Track how government sites are becoming more secure."
msgstr "Les Canadiens comptent sur le gouvernement du Canada pour fournir des services numériques sécurisés. La Politique sur les services et le numérique guide les services en ligne du gouvernement pour qu'ils adoptent de bonnes pratiques de sécurité pour les pratiques décrites dans les services de <0>courriel0> et les services <1>Web1>. Suivez l'évolution de la sécurisation des sites gouvernementaux."
-#: src/admin/SuperAdminUserList.js:432
+#: src/admin/SuperAdminUserList.js:434
#: src/user/UserPage.js:289
msgid "Cancel"
msgstr "Annuler"
@@ -513,8 +517,8 @@ msgstr "Dégager"
msgid "Close"
msgstr "Fermer"
-#: src/admin/SuperAdminUserList.js:369
-#: src/admin/SuperAdminUserList.js:402
+#: src/admin/SuperAdminUserList.js:371
+#: src/admin/SuperAdminUserList.js:404
#: src/user/UserPage.js:229
#: src/user/UserPage.js:260
msgid "Close Account"
@@ -1138,7 +1142,7 @@ msgid "English"
msgstr "Anglais"
#: src/admin/OrganizationInformation.js:501
-#: src/admin/SuperAdminUserList.js:413
+#: src/admin/SuperAdminUserList.js:415
msgid "Enter \"{0}\" below to confirm removal. This field is case-sensitive."
msgstr "Entrez \"{0}\" ci-dessous pour confirmer la suppression. Ce champ est sensible à la casse."
@@ -1786,18 +1790,23 @@ msgstr "Les balises informatives mettent en évidence des détails de configurat
msgid "Initiated By"
msgstr "Initiée par"
-#: src/user/InsideUserSwitch.js:83
-#~ msgid "Inside User"
-#~ msgstr "Utilisateur interne"
+#: src/admin/SuperAdminUserList.js:151
+#: src/admin/SuperAdminUserList.js:351
+msgid "Inside User"
+msgstr "Utilisateur interne"
+
+#: src/user/InsideUserSwitch.js:31
+msgid "Inside user status changed"
+msgstr "Changement du statut d'utilisateur interne"
#: src/admin/SuperAdminUserList.js:151
#: src/admin/SuperAdminUserList.js:350
-msgid "Insider"
-msgstr "Insider"
+#~ msgid "Insider"
+#~ msgstr "Insider"
#: src/user/InsideUserSwitch.js:31
-msgid "Insider status changed"
-msgstr "Changement de statut d'initié"
+#~ msgid "Insider status changed"
+#~ msgstr "Changement de statut d'initié"
#: src/termsConditions/TermsConditionsPage.js:132
msgid "Intellectual Property, Copyright and Trademarks"
@@ -2854,7 +2863,7 @@ msgstr "Rechercher un domaine"
msgid "Search for a tagged organization"
msgstr "Recherche d'une organisation étiquetée"
-#: src/admin/SuperAdminUserList.js:471
+#: src/admin/SuperAdminUserList.js:473
msgid "Search for a user (email)"
msgstr "Recherche d'un utilisateur (email)"
@@ -3378,7 +3387,7 @@ msgstr "Ces paramètres constituent une première étape importante dans la séc
msgid "These terms and conditions shall be governed by and interpreted under the laws of Canada, without regard for any choice of law rules. The courts of Canada shall have exclusive jurisdiction over all matters arising in relation to these terms and conditions."
msgstr "Les présentes conditions générales sont régies et interprétées en vertu des lois du Canada, sans égard aux règles de droit applicables. Les tribunaux du Canada auront la compétence exclusive sur toutes les questions relatives à ces conditions générales."
-#: src/admin/SuperAdminUserList.js:406
+#: src/admin/SuperAdminUserList.js:408
msgid "This action CANNOT be reversed, are you sure you wish to to close the account {0}?"
msgstr "Cette action ne peut être annulée, êtes-vous sûr de vouloir fermer le compte {0} ?"
@@ -3624,8 +3633,12 @@ msgid "Unable to update to your display name, please try again."
msgstr "Impossible de mettre à jour votre nom d'affichage, veuillez réessayer."
#: src/user/InsideUserSwitch.js:46
-msgid "Unable to update to your insider status, please try again."
-msgstr "Impossible de mettre à jour votre statut d'initié, veuillez réessayer."
+msgid "Unable to update to your inside user status, please try again."
+msgstr "Impossible de mettre à jour votre statut d'utilisateur interne, veuillez réessayer."
+
+#: src/user/InsideUserSwitch.js:46
+#~ msgid "Unable to update to your insider status, please try again."
+#~ msgstr "Impossible de mettre à jour votre statut d'initié, veuillez réessayer."
#: src/user/EditableUserLanguage.js:42
msgid "Unable to update to your preferred language, please try again."
@@ -3718,7 +3731,7 @@ msgstr "Utilisateur"
msgid "User Affiliations"
msgstr "Affiliations des utilisateurs"
-#: src/admin/SuperAdminUserList.js:421
+#: src/admin/SuperAdminUserList.js:423
#: src/user/UserPage.js:278
msgid "User Email"
msgstr "Courriel de l'utilisateur"
@@ -4012,8 +4025,12 @@ msgid "You have successfully updated your email."
msgstr "Vous avez mis à jour votre courriel avec succès."
#: src/user/InsideUserSwitch.js:32
-msgid "You have successfully updated your insider preference."
-msgstr "Vous avez réussi à mettre à jour vos préférences d'initié."
+msgid "You have successfully updated your inside user preference."
+msgstr "Vous avez réussi à mettre à jour vos préférences d'utilisateur interne."
+
+#: src/user/InsideUserSwitch.js:32
+#~ msgid "You have successfully updated your insider preference."
+#~ msgstr "Vous avez réussi à mettre à jour vos préférences d'initié."
#: src/user/EditableUserPassword.js:55
msgid "You have successfully updated your password."
diff --git a/frontend/src/user/InsideUserSwitch.js b/frontend/src/user/InsideUserSwitch.js
index cfc8398ec8..cb6e5c62b2 100644
--- a/frontend/src/user/InsideUserSwitch.js
+++ b/frontend/src/user/InsideUserSwitch.js
@@ -16,7 +16,7 @@ export function InsideUserSwitch({ insideUser }) {
{
onError: ({ message }) => {
toast({
- title: t`An error occurred while updating your insider preference.`,
+ title: t`An error occurred while updating your inside user preference.`,
description: message,
status: 'error',
duration: 9000,
@@ -25,11 +25,10 @@ export function InsideUserSwitch({ insideUser }) {
})
},
onCompleted({ updateUserProfile }) {
- console.log(updateUserProfile)
if (updateUserProfile.result.__typename === 'UpdateUserProfileResult') {
toast({
- title: t`Insider status changed`,
- description: t`You have successfully updated your insider preference.`,
+ title: t`Inside user status changed`,
+ description: t`You have successfully updated your inside user preference.`,
status: 'success',
duration: 9000,
isClosable: true,
@@ -43,7 +42,7 @@ export function InsideUserSwitch({ insideUser }) {
updateUserProfile.result.__typename === 'UpdateUserProfileError'
) {
toast({
- title: t`Unable to update to your insider status, please try again.`,
+ title: t`Unable to update to your inside user status, please try again.`,
description: updateUserProfile.result.description,
status: 'error',
duration: 9000,
@@ -75,7 +74,7 @@ export function InsideUserSwitch({ insideUser }) {
isFocusable={true}
id="Inside User"
name="Inside User"
- aria-label="Inside User"
+ aria-label="Feature Preview"
mx="2"
defaultChecked={insideUser}
onChange={async (e) =>
diff --git a/frontend/src/user/UserPage.js b/frontend/src/user/UserPage.js
index 137b0403cb..9759071468 100644
--- a/frontend/src/user/UserPage.js
+++ b/frontend/src/user/UserPage.js
@@ -42,7 +42,7 @@ import {
SIGN_OUT,
} from '../graphql/mutations'
import { NotificationBanner } from '../app/NotificationBanner'
-// import { InsideUserSwitch } from './InsideUserSwitch'
+import { InsideUserSwitch } from './InsideUserSwitch'
export default function UserPage() {
const toast = useToast()
@@ -164,7 +164,7 @@ export default function UserPage() {
tfaSendMethod,
emailValidated,
phoneValidated,
- // insideUser,
+ insideUser,
} = queryUserData?.userPage
return (
@@ -214,7 +214,7 @@ export default function UserPage() {
)}
- {/* */}
+
', () => {
await waitFor(() =>
expect(getByText(/Feature Preview/i)).toBeInTheDocument(),
)
- const betaSwitch = getByLabelText(/Inside User/i)
+ const betaSwitch = getByLabelText(/Feature Preview/i)
userEvent.click(betaSwitch)
- await waitFor(() => expect(getByText(/Insider status changed/i)))
+ await waitFor(() => expect(getByText(/Inside user status changed/i)))
})
it("fails when changing the user's status", async () => {
const mocks = [
@@ -146,12 +146,12 @@ describe('', () => {
await waitFor(() =>
expect(getByText(/Feature Preview/i)).toBeInTheDocument(),
)
- const betaSwitch = getByLabelText(/Inside User/i)
+ const betaSwitch = getByLabelText(/Feature Preview/i)
userEvent.click(betaSwitch)
await waitFor(() =>
expect(
getByText(
- /Unable to update to your insider status, please try again./i,
+ /Unable to update to your inside user status, please try again./i,
),
),
)