Skip to content

Commit 4d7d61c

Browse files
MelvinBotmadmax330
andcommitted
Address review feedback: eslint justification and case-insensitive linkedPolicyIDs check
Co-authored-by: Maxence Coulibaly <madmax330@users.noreply.github.com>
1 parent 3896482 commit 4d7d61c

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/hooks/useIsAllowedToIssueCompanyCard.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function useIsAllowedToIssueCompanyCard({policyID}: {policyID?: string}) {
2020
const selectedFeedData = selectedFeed && companyCards[selectedFeed];
2121
const [domain] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN}${selectedFeedData?.domainID}`);
2222

23-
if (selectedFeedData?.domainID === policy?.workspaceAccountID || (policyID && selectedFeedData?.linkedPolicyIDs?.includes(policyID))) {
23+
if (selectedFeedData?.domainID === policy?.workspaceAccountID || (policyID && selectedFeedData?.linkedPolicyIDs?.some((id) => id.toUpperCase() === policyID.toUpperCase()))) {
2424
return isPolicyAdmin;
2525
}
2626

tests/unit/hooks/useIsAllowedToIssueCompanyCard.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const mockedFeeds = {
3333
customFeedName: 'Custom feed name 1',
3434
feed: CONST.COMPANY_CARD.FEED_BANK_NAME.VISA,
3535
},
36-
// eslint-disable-next-line @typescript-eslint/naming-convention
36+
// eslint-disable-next-line @typescript-eslint/naming-convention -- Feed keys use the `vcf#<id>` format from the backend
3737
'vcf#22222222': {
3838
liabilityType: 'personal',
3939
pending: false,

0 commit comments

Comments
 (0)