Skip to content

Commit

Permalink
Change insider wording (#4148)
Browse files Browse the repository at this point in the history
* change wording for inside users

* update translations

* update tests

* add insider switch to Account Settings

* update test

* change inside user check from TBS email to SA status

* update test with mockprovider

---------

Co-authored-by: Tracker/Suivi <101344134+tracker-suivi@users.noreply.github.com>
  • Loading branch information
lcampbell2 and tracker-suivi authored May 15, 2023
1 parent cb62dce commit 26960ab
Show file tree
Hide file tree
Showing 8 changed files with 131 additions and 79 deletions.
22 changes: 12 additions & 10 deletions frontend/src/admin/SuperAdminUserList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -340,15 +340,17 @@ export function SuperAdminUserList({ permission }) {
>
<Trans>Verified</Trans>
</Badge>
<Badge
variant="solid"
bg={insideUser ? 'strong' : 'weak'}
pt={1}
mr={{ md: '1rem' }}
justifySelf={{ base: 'start', md: 'end' }}
>
<Trans>Insider</Trans>
</Badge>
{insideUser && (
<Badge
variant="solid"
bg="strong"
pt={1}
mr={{ md: '1rem' }}
justifySelf={{ base: 'start', md: 'end' }}
>
<Trans>Inside User</Trans>
</Badge>
)}
</Flex>
<Text minW="17%">
<Trans>Affiliations:</Trans> {totalCount}
Expand Down
38 changes: 26 additions & 12 deletions frontend/src/admin/__tests__/AdminDomainCard.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -17,21 +19,33 @@ const i18n = setupI18n({
},
})

const mocks = [
{
request: {
query: IS_USER_SUPER_ADMIN,
},
result: {
data: {
isUserSuperAdmin: false,
},
},
},
]

describe('<Domain />', () => {
it('represents a domain', async () => {
const { getByText } = render(
<ChakraProvider theme={theme}>
<I18nProvider i18n={i18n}>
<MemoryRouter initialEntries={['/']} initialIndex={0}>
<List>
<AdminDomainCard
url="canada.ca"
data-testid="domain"
/>
</List>
</MemoryRouter>
</I18nProvider>
</ChakraProvider>,
<MockedProvider mocks={mocks}>
<ChakraProvider theme={theme}>
<I18nProvider i18n={i18n}>
<MemoryRouter initialEntries={['/']} initialIndex={0}>
<List>
<AdminDomainCard url="canada.ca" data-testid="domain" />
</List>
</MemoryRouter>
</I18nProvider>
</ChakraProvider>
</MockedProvider>,
)

await waitFor(() => {
Expand Down
11 changes: 7 additions & 4 deletions frontend/src/app/ABTestWrapper.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
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 }) {
return <>{children}</>
}

export function ABTestingWrapper({ children, insiderVariantName = 'B' }) {
const { data } = useQuery(IS_USER_SUPER_ADMIN)
const { currentUser } = useUserVar()
let childIndex = 0

// only one variant
if (!children.length) {
if (
isInsiderUser({
userName: currentUser?.userName || '',
isUserSuperAdmin: data?.isUserSuperAdmin || false,
insideUser: currentUser?.insideUser || false,
})
) {
Expand All @@ -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,
})
) {
Expand Down
57 changes: 37 additions & 20 deletions frontend/src/locales/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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>email</0> and <1>web</1> 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>email</0> and <1>web</1> 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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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."

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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)"

Expand Down Expand Up @@ -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}?"

Expand Down Expand Up @@ -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."
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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."
Expand Down
57 changes: 37 additions & 20 deletions frontend/src/locales/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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>email</0> and <1>web</1> 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>courriel</0> et les services <1>Web</1>. 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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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."

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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)"

Expand Down Expand Up @@ -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} ?"

Expand Down Expand Up @@ -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."
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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."
Expand Down
Loading

0 comments on commit 26960ab

Please sign in to comment.