Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,8 @@ const translations: TranslationDeepObject<typeof en> = {
member: 'Mitglied',
auditor: 'Prüfer',
role: 'Rolle',
roleCannotBeChanged: (workflowsLinkPage: string) =>
`Die Rolle kann nicht geändert werden, da dieses Mitglied ein <a href="${workflowsLinkPage}">zahler</a> in diesem Arbeitsbereich ist.`,
currency: 'Währung',
groupCurrency: 'Gruppenwährung',
rate: 'Bewerten',
Expand Down
1 change: 1 addition & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ const translations = {
member: 'Member',
auditor: 'Auditor',
role: 'Role',
roleCannotBeChanged: (workflowsLinkPage: string) => `Role can't be changed because this member is a <a href="${workflowsLinkPage}">payer</a> on this workspace.`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's capitalize the "payer" as shown here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see this

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay thanks!

currency: 'Currency',
groupCurrency: 'Group currency',
rate: 'Rate',
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ const translations: TranslationDeepObject<typeof en> = {
success: 'Éxito',
auditor: 'Auditor',
role: 'Role',
roleCannotBeChanged: (workflowsLinkPage: string) => `El rol no se puede cambiar porque este miembro es un <a href="${workflowsLinkPage}">pagador</a> en este espacio de trabajo.`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you confirmed this on Slack?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please link it here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nevermind, it's on the comment above

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currency: 'Divisa',
groupCurrency: 'Moneda del grupo',
rate: 'Tarifa',
Expand Down
1 change: 1 addition & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ const translations: TranslationDeepObject<typeof en> = {
member: 'Membre',
auditor: 'Auditeur',
role: 'Rôle',
roleCannotBeChanged: (workflowsLinkPage: string) => `Le rôle ne peut pas être modifié car ce membre est un <a href="${workflowsLinkPage}">payeur</a> dans cet espace de travail.`,
currency: 'Devise',
groupCurrency: 'Devise du groupe',
rate: 'Taux',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,8 @@ const translations: TranslationDeepObject<typeof en> = {
member: 'Membro',
auditor: 'Revisore',
role: 'Ruolo',
roleCannotBeChanged: (workflowsLinkPage: string) =>
`Il ruolo non può essere modificato perché questo membro è un <a href="${workflowsLinkPage}">pagatore</a> in questo spazio di lavoro.`,
currency: 'Valuta',
groupCurrency: 'Valuta del gruppo',
rate: 'Valuta',
Expand Down
1 change: 1 addition & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ const translations: TranslationDeepObject<typeof en> = {
member: 'メンバー',
auditor: '監査人',
role: '役割',
roleCannotBeChanged: (workflowsLinkPage: string) => `このメンバーはこのワークスペースの<a href="${workflowsLinkPage}">支払者</a>であるため、役割を変更できません。`,
currency: '通貨',
groupCurrency: 'グループ通貨',
rate: '評価',
Expand Down
1 change: 1 addition & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ const translations: TranslationDeepObject<typeof en> = {
member: 'Lid',
auditor: 'Auditor',
role: 'Rol',
roleCannotBeChanged: (workflowsLinkPage: string) => `De rol kan niet worden gewijzigd omdat dit lid een <a href="${workflowsLinkPage}">betaler</a> is in deze werkruimte.`,
currency: 'Valuta',
groupCurrency: 'Groepsvaluta',
rate: 'Beoordeling',
Expand Down
1 change: 1 addition & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ const translations: TranslationDeepObject<typeof en> = {
member: 'Członek',
auditor: 'Audytor',
role: 'Rola',
roleCannotBeChanged: (workflowsLinkPage: string) => `Nie można zmienić roli, ponieważ ten członek jest <a href="${workflowsLinkPage}">płatnikiem</a> w tym obszarze roboczym.`,
currency: 'Waluta',
groupCurrency: 'Waluta grupy',
rate: 'Oceń',
Expand Down
1 change: 1 addition & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ const translations: TranslationDeepObject<typeof en> = {
member: 'Membro',
auditor: 'Auditor',
role: 'Função',
roleCannotBeChanged: (workflowsLinkPage: string) => `A função não pode ser alterada porque este membro é um <a href="${workflowsLinkPage}">pagador</a> neste espaço de trabalho.`,
currency: 'Moeda',
groupCurrency: 'Moeda do grupo',
rate: 'Avaliar',
Expand Down
1 change: 1 addition & 0 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ const translations: TranslationDeepObject<typeof en> = {
member: '成员',
auditor: '审计员',
role: '角色',
roleCannotBeChanged: (workflowsLinkPage: string) => `该角色无法更改,因为此成员是此工作区中的<a href="${workflowsLinkPage}">付款人</a>。`,
currency: '货币',
groupCurrency: '群组货币',
rate: '评分',
Expand Down
6 changes: 4 additions & 2 deletions src/pages/workspace/WorkspaceMembersPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@
* Remove selected users from the workspace
* Please see https://github.com/Expensify/App/blob/main/README.md#Security for more details
*/
const removeUsers = () => {

Check warning on line 229 in src/pages/workspace/WorkspaceMembersPage.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

The 'removeUsers' function makes the dependencies of useCallback Hook (at line 290) change on every render. Move it inside the useCallback callback. Alternatively, wrap the definition of 'removeUsers' in its own useCallback() Hook
// Check if any of the members are approvers
const hasApprovers = selectedEmployees.some((email) => isApprover(policy, email));

Expand Down Expand Up @@ -659,16 +659,18 @@
const hasAtLeastOneNonAuditorRole = selectedEmployeesRoles.some((role) => role !== CONST.POLICY.ROLE.AUDITOR);
const hasAtLeastOneNonMemberRole = selectedEmployeesRoles.some((role) => role !== CONST.POLICY.ROLE.USER);
const hasAtLeastOneNonAdminRole = selectedEmployeesRoles.some((role) => role !== CONST.POLICY.ROLE.ADMIN);
const isReimbursementEnabled = policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES;
const hasAtLeastOnePayer = isReimbursementEnabled && policy?.achAccount?.reimburser ? selectedEmployees.includes(policy?.achAccount?.reimburser) : false;

if (hasAtLeastOneNonMemberRole) {
if (hasAtLeastOneNonMemberRole && !hasAtLeastOnePayer) {
options.push(memberOption);
}

if (hasAtLeastOneNonAdminRole) {
options.push(adminOption);
}

if (hasAtLeastOneNonAuditorRole && isControlPolicy(policy)) {
if (hasAtLeastOneNonAuditorRole && isControlPolicy(policy) && !hasAtLeastOnePayer) {
options.push(auditorOption);
}

Expand Down
10 changes: 8 additions & 2 deletions src/pages/workspace/members/WorkspaceMemberDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import useCardFeeds from '@hooks/useCardFeeds';
import {useCompanyCardFeedIcons} from '@hooks/useCompanyCardIcons';
import useConfirmModal from '@hooks/useConfirmModal';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useEnvironment from '@hooks/useEnvironment';
import useExpensifyCardFeeds from '@hooks/useExpensifyCardFeeds';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
Expand Down Expand Up @@ -84,6 +85,7 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM
const illustrations = useThemeIllustrations();
const companyCardFeedIcons = useCompanyCardFeedIcons();
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const {environmentURL} = useEnvironment();
const [cardFeeds] = useCardFeeds(policyID);
const [cardList] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST}`, {canBeMissing: true});
const [customCardNames] = useOnyx(ONYXKEYS.NVP_EXPENSIFY_COMPANY_CARDS_CUSTOM_NAMES, {canBeMissing: true});
Expand All @@ -106,9 +108,10 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM
const policyOwnerDisplayName = formatPhoneNumber(getDisplayNameOrDefault(ownerDetails)) ?? policy?.owner ?? '';
const hasMultipleFeeds = Object.keys(getCompanyFeeds(cardFeeds, false, true)).length > 0;
const {cardList: assignableCards, ...workspaceCards} = getAllCardsForWorkspace(workspaceAccountID, cardList, cardFeeds, expensifyCardSettings);
const workspaceWorkflowsPageURL = `${environmentURL}/${ROUTES.WORKSPACE_WORKFLOWS.getRoute(policyID)}`;
const isSMSLogin = Str.isSMSLogin(memberLogin);
const phoneNumber = getPhoneNumber(details);
const isReimburser = policy?.achAccount?.reimburser === memberLogin;
const isReimburser = policy?.reimbursementChoice === CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES && policy?.achAccount?.reimburser === memberLogin;
const {isAccountLocked, showLockedAccountModal} = useContext(LockedAccountContext);

const {approvalWorkflows} = convertPolicyEmployeesToApprovalWorkflows({
Expand Down Expand Up @@ -340,9 +343,12 @@ function WorkspaceMemberDetailsPage({personalDetails, policy, route}: WorkspaceM
<MenuItemWithTopDescription
disabled={isSelectedMemberOwner || isSelectedMemberCurrentUser}
title={translate(`workspace.common.roleName`, member?.role)}
interactive={!isReimburser}
description={translate('common.role')}
shouldShowRightIcon
shouldShowRightIcon={!isReimburser}
onPress={() => Navigation.navigate(ROUTES.WORKSPACE_MEMBER_DETAILS_ROLE.getRoute(policyID, accountID))}
hintText={isReimburser ? translate('common.roleCannotBeChanged', workspaceWorkflowsPageURL) : undefined}
shouldRenderHintAsHTML
/>
{isControlPolicy(policy) && (
<>
Expand Down
Loading