Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
256a7d6
Basic revoke admin access
jmusial Dec 16, 2025
764ceee
Error habdling
jmusial Dec 16, 2025
20aa7a6
Merge branch 'main' into feat/domain-revoke-admin-access
jmusial Dec 17, 2025
a5ceb39
remove redundant onyxkey
jmusial Dec 17, 2025
6034354
update pending action structure
jmusial Dec 17, 2025
6f0125f
Merge branch 'main' into feat/domain-revoke-admin-access
jmusial Dec 17, 2025
24d8ae8
Merge branch 'main' into feat/domain-revoke-admin-access
jmusial Dec 17, 2025
ef412d8
fix after merge
jmusial Dec 17, 2025
aedc0fb
add pending action
jmusial Dec 17, 2025
102efa9
Merge branch 'main' into feat/domain-revoke-admin-access
jmusial Dec 18, 2025
ab95b79
Merge branch 'main' into feat/domain-revoke-admin-access
jmusial Dec 22, 2025
12160f7
Merge branch 'main' into feat/domain-revoke-admin-access
jmusial Dec 23, 2025
8f24ba7
fix merge issue
jmusial Dec 23, 2025
be00cbc
Merge branch 'main' into feat/domain-revoke-admin-access
jmusial Jan 7, 2026
183ceb8
update for backend
jmusial Jan 7, 2026
3317415
remove unused util
jmusial Jan 7, 2026
fadf6fe
Merge branch 'main' into feat/domain-revoke-admin-access
jmusial Jan 8, 2026
78d1045
translations
jmusial Jan 8, 2026
33bb57f
fix pr comments
jmusial Jan 8, 2026
0b2e5c3
change canBeMissing to false
jmusial Jan 8, 2026
0e0c8ed
remove empty line
jmusial Jan 8, 2026
4412cc9
fix the permissionKey logic
jmusial Jan 8, 2026
14f0afd
disabled row on delete offline
jmusial Jan 9, 2026
2468563
change confirm & cancel text on confirm modal
jmusial Jan 9, 2026
e28d3bc
update jsdoc
jmusial Jan 9, 2026
462d80e
prettier fix
jmusial Jan 9, 2026
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
3 changes: 3 additions & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7935,6 +7935,9 @@ Hier ist ein *Testbeleg*, um dir zu zeigen, wie es funktioniert:`,
addAdmin: 'Admin hinzufügen',
invite: 'Einladen',
addAdminError: 'Dieser Benutzer kann nicht als Admin hinzugefügt werden. Bitte versuche es erneut.',
revokeAdminAccess: 'Administratorzugriff widerrufen',
cantRevokeAdminAccess: 'Adminzugriff kann dem technischen Ansprechpartner nicht entzogen werden',
error: {removeAdmin: 'Dieser Benutzer kann nicht als Admin entfernt werden. Bitte versuchen Sie es erneut.'},
},
},
gps: {
Expand Down
5 changes: 5 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7828,6 +7828,11 @@ const translations = {
addAdmin: 'Add admin',
invite: 'Invite',
addAdminError: 'Unable to add this member as an admin. Please try again.',
revokeAdminAccess: 'Revoke admin access',
cantRevokeAdminAccess: "Can't revoke admin access from the technical contact",
error: {
removeAdmin: 'Unable to remove this user as an Admin. Please try again.',
},
},
},
};
Expand Down
3 changes: 3 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7974,6 +7974,9 @@ ${amount} para ${merchant} - ${date}`,
addAdmin: 'Añadir administrador',
invite: 'Invitar',
addAdminError: 'No se pudo añadir a este miembro como administrador. Por favor, inténtalo de nuevo.',
revokeAdminAccess: 'Revocar acceso de administrador',
cantRevokeAdminAccess: 'No se puede revocar el acceso de administrador del contacto técnico',
error: {removeAdmin: 'No se pudo eliminar a este usuario como administrador. Por favor, inténtalo de nuevo.'},
},
},
gps: {
Expand Down
3 changes: 3 additions & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7940,6 +7940,9 @@ Voici un *reçu test* pour vous montrer comment cela fonctionne :`,
addAdmin: 'Ajouter un administrateur',
invite: 'Inviter',
addAdminError: 'Impossible d’ajouter ce membre en tant qu’administrateur. Veuillez réessayer.',

@ZhenjaHorbach ZhenjaHorbach Jan 8, 2026

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.

Strange that for FR we have double quotes
Let's fix it!

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.

There's difference.
Before:
After: '

Is it intentional or just generated by translator bot?

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.

That was auto genenerated but the bot. There are both patterns present in the file (other langs too). But is more common in fr.ts so changed it to match

revokeAdminAccess: 'Révoquer l’accès administrateur',
cantRevokeAdminAccess: 'Impossible de révoquer l’accès administrateur au contact technique',
error: {removeAdmin: 'Impossible de supprimer cet utilisateur en tant qu’administrateur. Veuillez réessayer.'},
},
},
gps: {
Expand Down
3 changes: 3 additions & 0 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7918,6 +7918,9 @@ Ecco una *ricevuta di prova* per mostrarti come funziona:`,
addAdmin: 'Aggiungi amministratore',
invite: 'Invita',
addAdminError: 'Impossibile aggiungere questo membro come amministratore. Riprova.',
revokeAdminAccess: 'Revoca accesso amministratore',
cantRevokeAdminAccess: 'Impossibile revocare i privilegi di amministratore dal referente tecnico',
error: {removeAdmin: 'Impossibile rimuovere questo utente come amministratore. Riprova.'},
},
},
gps: {
Expand Down
3 changes: 3 additions & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7856,6 +7856,9 @@ Expensify の使い方をお見せするための*テストレシート*がこ
addAdmin: '管理者を追加',
invite: '招待',
addAdminError: 'このメンバーを管理者として追加できません。もう一度お試しください。',
revokeAdminAccess: '管理者アクセスを取り消す',
cantRevokeAdminAccess: '技術連絡先から管理者アクセス権を取り消すことはできません',
error: {removeAdmin: 'このユーザーを管理者として削除できません。もう一度お試しください。'},
},
},
gps: {
Expand Down
3 changes: 3 additions & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7904,6 +7904,9 @@ Hier is een *testbon* om je te laten zien hoe het werkt:`,
addAdmin: 'Beheerder toevoegen',
invite: 'Uitnodigen',
addAdminError: 'Kan dit lid niet als beheerder toevoegen. Probeer het opnieuw.',
revokeAdminAccess: 'Beheerdersrechten intrekken',
cantRevokeAdminAccess: 'Kan de beheerdersrechten niet intrekken van de technische contactpersoon',
error: {removeAdmin: 'Kan deze gebruiker niet als beheerder verwijderen. Probeer het opnieuw.'},
},
},
gps: {
Expand Down
3 changes: 3 additions & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7888,6 +7888,9 @@ Oto *paragon testowy*, który pokazuje, jak to działa:`,
addAdmin: 'Dodaj administratora',
invite: 'Zaproś',
addAdminError: 'Nie można dodać tego członka jako administratora. Spróbuj ponownie.',
revokeAdminAccess: 'Cofnij uprawnienia administratora',
cantRevokeAdminAccess: 'Nie można odebrać uprawnień administratora kontaktowi technicznemu',
error: {removeAdmin: 'Nie można usunąć tego użytkownika jako administratora. Spróbuj ponownie.'},
},
},
gps: {
Expand Down
3 changes: 3 additions & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7894,6 +7894,9 @@ Aqui está um *recibo de teste* para mostrar como funciona:`,
addAdmin: 'Adicionar administrador',
invite: 'Convidar',
addAdminError: 'Não foi possível adicionar este membro como administrador. Tente novamente.',
revokeAdminAccess: 'Revogar acesso de administrador',
cantRevokeAdminAccess: 'Não é possível revogar o acesso de administrador do contato técnico',
error: {removeAdmin: 'Não foi possível remover este usuário como Administrador. Tente novamente.'},
},
},
gps: {
Expand Down
3 changes: 3 additions & 0 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7712,6 +7712,9 @@ ${reportName}
addAdmin: '添加管理员',
invite: '邀请',
addAdminError: '无法将此成员添加为管理员。请重试。',
revokeAdminAccess: '撤销管理员访问权限',
cantRevokeAdminAccess: '无法撤销技术联系人的管理员访问权限',
error: {removeAdmin: '无法将此用户移除管理员角色。请重试。'},
},
},
gps: {
Expand Down
6 changes: 6 additions & 0 deletions src/libs/API/parameters/RemoveDomainAdminParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type RemoveDomainAdminParams = {
domainAccountID: number;
targetAccountID: number;
};

export default RemoveDomainAdminParams;
1 change: 1 addition & 0 deletions src/libs/API/parameters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,3 +454,4 @@ export type {default as UpdateSamlRequiredParams} from './UpdateSamlRequiredPara
export type {default as SetPolicyRequireCompanyCardsEnabledParams} from './SetPolicyRequireCompanyCardsEnabled';
export type {default as SetTechnicalContactEmailParams} from './SetTechnicalContactEmailParams';
export type {default as ToggleConsolidatedDomainBillingParams} from './ToggleConsolidatedDomainBillingParams';
export type {default as RemoveDomainAdminParams} from './RemoveDomainAdminParams';
2 changes: 2 additions & 0 deletions src/libs/API/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ const WRITE_COMMANDS = {
SET_TECHNICAL_CONTACT_EMAIL: 'SetTechnicalContactEmail',
TOGGLE_CONSOLIDATED_DOMAIN_BILLING: 'ToggleConsolidatedDomainBilling',
ADD_DOMAIN_ADMIN: 'AddDomainAdmin',
REMOVE_DOMAIN_ADMIN: 'RemoveDomainAdmin',
} as const;

type WriteCommand = ValueOf<typeof WRITE_COMMANDS>;
Expand Down Expand Up @@ -1082,6 +1083,7 @@ type WriteCommandParameters = {
[WRITE_COMMANDS.CREATE_DOMAIN]: Parameters.DomainParams;
[WRITE_COMMANDS.SET_TECHNICAL_CONTACT_EMAIL]: Parameters.SetTechnicalContactEmailParams;
[WRITE_COMMANDS.TOGGLE_CONSOLIDATED_DOMAIN_BILLING]: Parameters.ToggleConsolidatedDomainBillingParams;
[WRITE_COMMANDS.REMOVE_DOMAIN_ADMIN]: Parameters.RemoveDomainAdminParams;
[WRITE_COMMANDS.ADD_DOMAIN_ADMIN]: Parameters.AddAdminToDomainParams;
};

Expand Down
75 changes: 65 additions & 10 deletions src/libs/actions/Domain.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Onyx from 'react-native-onyx';
import type {OnyxUpdate} from 'react-native-onyx';
import * as API from '@libs/API';
import type {AddAdminToDomainParams, SetTechnicalContactEmailParams, ToggleConsolidatedDomainBillingParams} from '@libs/API/parameters';
import type {AddAdminToDomainParams, RemoveDomainAdminParams, SetTechnicalContactEmailParams, ToggleConsolidatedDomainBillingParams} from '@libs/API/parameters';
import {READ_COMMANDS, SIDE_EFFECT_REQUEST_COMMANDS, WRITE_COMMANDS} from '@libs/API/types';
import {getMicroSecondOnyxErrorWithTranslationKey} from '@libs/ErrorUtils';
import {getAuthToken} from '@libs/Network/NetworkStore';
Expand Down Expand Up @@ -625,15 +625,9 @@ function addAdminToDomain(domainAccountID: number, accountID: number, targetEmai
}

/**
* Removes an error after trying to add admin
* Removes an error and pending actions after trying to add admin
*/
function clearAddAdminError(domainAccountID: number, accountID: number) {
const PERMISSION_KEY = `${ONYXKEYS.COLLECTION.EXPENSIFY_ADMIN_ACCESS_PREFIX}${accountID}`;

Onyx.merge(`${ONYXKEYS.COLLECTION.DOMAIN}${domainAccountID}`, {
[PERMISSION_KEY]: null,
});

function clearAdminError(domainAccountID: number, accountID: number) {
Onyx.merge(`${ONYXKEYS.COLLECTION.DOMAIN_ERRORS}${domainAccountID}`, {
adminErrors: {
[accountID]: null,
Expand All @@ -646,6 +640,66 @@ function clearAddAdminError(domainAccountID: number, accountID: number) {
},
});
}
/**
* Removes admin access for a domain member
*/
function revokeDomainAdminAccess(domainAccountID: number, accountID: number) {
const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.DOMAIN_PENDING_ACTIONS}${domainAccountID}`,
value: {
admin: {
[accountID]: {
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE,
},
},
},
},
];
const successData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.DOMAIN_PENDING_ACTIONS}${domainAccountID}`,
value: {
admin: {
[accountID]: {
pendingAction: null,
},
},
},
},
];
Comment on lines +660 to +672

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.

If we do not want to remove them from the domain in optimistic data, should we remove them in the successData?

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.

Yeah I found it a but strange with removing those permissions and optimistics...

It does behave as it should without removing it manually in optimistic data so I removed that part. Unless there is sth I'm missing...

See the video 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.

Yeah that looks correct, I think it is just odd as we have the domain_pending_actions concept as separate collection

const failureData: OnyxUpdate[] = [
Comment thread
mountiny marked this conversation as resolved.
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.DOMAIN_PENDING_ACTIONS}${domainAccountID}`,
value: {
admin: {
[accountID]: {
pendingAction: null,
},
},
},
},
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.DOMAIN_ERRORS}${domainAccountID}`,
value: {
adminErrors: {
[accountID]: {errors: getMicroSecondOnyxErrorWithTranslationKey('domain.admins.error.removeAdmin')},
},
},
Comment thread
mountiny marked this conversation as resolved.
},
];

const parameters: RemoveDomainAdminParams = {
domainAccountID,
targetAccountID: accountID,
};

API.write(WRITE_COMMANDS.REMOVE_DOMAIN_ADMIN, parameters, {optimisticData, successData, failureData});
}

export {
getDomainValidationCode,
Expand All @@ -666,5 +720,6 @@ export {
toggleConsolidatedDomainBilling,
clearToggleConsolidatedDomainBillingErrors,
addAdminToDomain,
clearAddAdminError,
clearAdminError,
revokeDomainAdminAccess,
};
48 changes: 47 additions & 1 deletion src/pages/domain/Admins/DomainAdminDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ import Avatar from '@components/Avatar';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import MenuItem from '@components/MenuItem';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import {ModalActions} from '@components/Modal/Global/ModalContext';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
import ScreenWrapper from '@components/ScreenWrapper';
import ScrollView from '@components/ScrollView';
import Text from '@components/Text';
import useConfirmModal from '@hooks/useConfirmModal';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import useThemeStyles from '@hooks/useThemeStyles';
import {revokeDomainAdminAccess} from '@libs/actions/Domain';
import {getDisplayNameOrDefault, getPhoneNumber} from '@libs/PersonalDetailsUtils';
import Navigation from '@navigation/Navigation';
import type {PlatformStackScreenProps} from '@navigation/PlatformStackNavigation/types';
Expand All @@ -23,6 +26,7 @@ import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type SCREENS from '@src/SCREENS';
import {adminAccountIDsSelector, domainSettingsPrimaryContactSelector} from '@src/selectors/Domain';
import type {PersonalDetailsList} from '@src/types/onyx';

type DomainAdminDetailsPageProps = PlatformStackScreenProps<SettingsNavigatorParamList, typeof SCREENS.DOMAIN.ADMIN_DETAILS>;
Expand All @@ -31,7 +35,17 @@ function DomainAdminDetailsPage({route}: DomainAdminDetailsPageProps) {
const {domainAccountID, accountID} = route.params;
const styles = useThemeStyles();
const {translate, formatPhoneNumber} = useLocalize();
const icons = useMemoizedLazyExpensifyIcons(['Info'] as const);
const icons = useMemoizedLazyExpensifyIcons(['Info', 'ClosedSign'] as const);

const [primaryContact] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${domainAccountID}`, {
selector: domainSettingsPrimaryContactSelector,
canBeMissing: true,
});

const [adminAccountIDs] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN}${domainAccountID}`, {
canBeMissing: true,
selector: adminAccountIDsSelector,
});

// eslint-disable-next-line rulesdir/no-inline-useOnyx-selector
const [adminPersonalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {
Expand All @@ -41,10 +55,32 @@ function DomainAdminDetailsPage({route}: DomainAdminDetailsPageProps) {

const displayName = formatPhoneNumber(getDisplayNameOrDefault(adminPersonalDetails));
const memberLogin = adminPersonalDetails?.login ?? '';
const isCurrentUserPrimaryContact = primaryContact === memberLogin;
const isSMSLogin = Str.isSMSLogin(memberLogin);
const phoneNumber = getPhoneNumber(adminPersonalDetails);
const fallbackIcon = adminPersonalDetails?.fallbackIcon ?? '';

const domainHasOnlyOneAdmin = adminAccountIDs?.length === 1;
const {showConfirmModal} = useConfirmModal();

const handleRevokeAdminAccess = async () => {
const confirmResult = await showConfirmModal({
title: translate('domain.admins.revokeAdminAccess'),
prompt: translate('workspace.people.removeMemberPrompt', {memberName: displayName}),
confirmText: translate('common.remove'),
cancelText: translate('common.cancel'),

shouldShowCancelButton: true,
danger: true,
});
if (confirmResult.action !== ModalActions.CONFIRM) {
return;
}

revokeDomainAdminAccess(route.params.domainAccountID, route.params.accountID);
Navigation.dismissModal();
};

return (
<DomainNotFoundPageWrapper domainAccountID={domainAccountID}>
<ScreenWrapper
Expand Down Expand Up @@ -83,6 +119,16 @@ function DomainAdminDetailsPage({route}: DomainAdminDetailsPageProps) {
interactive={false}
copyable
/>
{!domainHasOnlyOneAdmin && (
<MenuItem
disabled={isCurrentUserPrimaryContact}
hintText={isCurrentUserPrimaryContact ? translate('domain.admins.cantRevokeAdminAccess') : undefined}
style={styles.mb5}
title={translate('domain.admins.revokeAdminAccess')}
icon={icons.ClosedSign}
onPress={handleRevokeAdminAccess}
/>
)}
<MenuItem
style={styles.mb5}
title={translate('common.profile')}
Expand Down
23 changes: 17 additions & 6 deletions src/pages/domain/Admins/DomainAdminsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {adminAccountIDsSelector, technicalContactSettingsSelector} from '@selectors/Domain';
import {adminAccountIDsSelector, adminPendingActionSelector, technicalContactSettingsSelector} from '@selectors/Domain';
import React from 'react';
import {View} from 'react-native';
import Badge from '@components/Badge';
Expand Down Expand Up @@ -26,7 +26,7 @@ import Navigation from '@navigation/Navigation';
import type {PlatformStackScreenProps} from '@navigation/PlatformStackNavigation/types';
import type {DomainSplitNavigatorParamList} from '@navigation/types';
import DomainNotFoundPageWrapper from '@pages/domain/DomainNotFoundPageWrapper';
import {clearAddAdminError} from '@userActions/Domain';
import {clearAdminError} from '@userActions/Domain';
import {getCurrentUserAccountID} from '@userActions/Report';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down Expand Up @@ -54,13 +54,21 @@ function DomainAdminsPage({route}: DomainAdminsPageProps) {
canBeMissing: true,
selector: adminAccountIDsSelector,
});

const [domainErrors] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN_ERRORS}${domainAccountID}`, {
canBeMissing: true,
});

const [domainPendingAction] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN_PENDING_ACTIONS}${domainAccountID}`, {

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.

It would be great to explain in the definition of the pending actions why we need it and why we just dont add it to the domain_ collection that is common for other collections (we dont have Reports_pending_actions)

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.

updated in jsdoc in src/types/onyx/DomainPendingActions.ts. Let me know if it's ok as I was't a part of those discussions an may have misunderstood sth

canBeMissing: true,
selector: adminPendingActionSelector,
});

const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {canBeMissing: true});
const [technicalContactSettings] = useOnyx(`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${domainAccountID}`, {
canBeMissing: false,
selector: technicalContactSettingsSelector,
});
const [domainErrors] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN_ERRORS}${domainAccountID}`, {canBeMissing: true});
const [domainPendingActions] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN_PENDING_ACTIONS}${domainAccountID}`, {canBeMissing: true});

const currentUserAccountID = getCurrentUserAccountID();
const isAdmin = adminAccountIDs?.includes(currentUserAccountID);
Expand All @@ -69,6 +77,7 @@ function DomainAdminsPage({route}: DomainAdminsPageProps) {
for (const accountID of adminAccountIDs ?? []) {
const details = personalDetails?.[accountID];
const isPrimaryContact = technicalContactSettings?.technicalContactEmail === details?.login;
const isPendingActionDelete = domainPendingAction?.[accountID]?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE;
data.push({
keyForList: String(accountID),
accountID,
Expand All @@ -85,7 +94,9 @@ function DomainAdminsPage({route}: DomainAdminsPageProps) {
],
rightElement: isPrimaryContact && <Badge text={translate('domain.admins.primaryContact')} />,
errors: getLatestError(domainErrors?.adminErrors?.[accountID]?.errors),
pendingAction: domainPendingActions?.admin?.[accountID]?.pendingAction,
pendingAction: domainPendingAction?.[accountID]?.pendingAction,
isInteractive: !isPendingActionDelete,
isDisabled: isPendingActionDelete,
});
}

Expand Down Expand Up @@ -183,7 +194,7 @@ function DomainAdminsPage({route}: DomainAdminsPageProps) {
showScrollIndicator={false}
addBottomSafeAreaPadding
customListHeader={getCustomListHeader()}
onDismissError={(item: AdminOption) => clearAddAdminError(domainAccountID, item.accountID)}
onDismissError={(item: AdminOption) => clearAdminError(domainAccountID, item.accountID)}
Comment thread
mountiny marked this conversation as resolved.
/>
</ScreenWrapper>
</DomainNotFoundPageWrapper>
Expand Down
Loading
Loading