Skip to content

Commit b6bd285

Browse files
MelvinBotgrgia
andcommitted
Fix filterAllInactiveCards to show all suspended cards and exclude deactivated cards
When includeDeactivated is true, show all suspended cards (not just zero-limit ones) so admins can view and edit them. Remove the deactivated card path entirely since the server rejects limit updates on STATE_DEACTIVATED cards with a 403 error. Co-authored-by: Georgia Monahan <grgia@users.noreply.github.com>
1 parent 8cba886 commit b6bd285

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

src/libs/CardUtils.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,12 +1060,8 @@ function filterAllInactiveCards(cards: CardList | undefined, includeDeactivated
10601060

10611061
const closedStates = new Set<number>([CONST.EXPENSIFY_CARD.STATE.CLOSED, CONST.EXPENSIFY_CARD.STATE.STATE_DEACTIVATED]);
10621062
return filterObject(cards, (_key, card) => {
1063-
const isAdminZeroedExpensifyCard = isExpensifyCard(card) && isCardWithCustomZeroLimit(card);
10641063
if (card.state === CONST.EXPENSIFY_CARD.STATE.STATE_SUSPENDED) {
1065-
return !!card.nameValuePairs?.frozen || (includeDeactivated && isAdminZeroedExpensifyCard);
1066-
}
1067-
if (card.state === CONST.EXPENSIFY_CARD.STATE.STATE_DEACTIVATED) {
1068-
return includeDeactivated && isAdminZeroedExpensifyCard;
1064+
return !!card.nameValuePairs?.frozen || includeDeactivated;
10691065
}
10701066
return !closedStates.has(card.state);
10711067
});
@@ -1083,7 +1079,7 @@ function filterInactiveCards(cardsList: WorkspaceCardsList | undefined) {
10831079

10841080
/**
10851081
* Onyx selector for workspace Expensify Card management pages. Same as `filterInactiveCards`, but also
1086-
* keeps issued deactivated cards and zero-limit suspended cards so admins can view and edit them.
1082+
* keeps all suspended cards so admins can view and edit them.
10871083
*/
10881084
function filterInactiveCardsForWorkspace(cardsList: WorkspaceCardsList | undefined) {
10891085
const {cardList, ...assignedCards} = cardsList ?? {};

0 commit comments

Comments
 (0)