From 1ee821d1ddab9657f9875b2b7be8428b5b40661b Mon Sep 17 00:00:00 2001 From: Carlos Alvarez Date: Fri, 23 Feb 2024 11:10:45 -0800 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> --- src/libs/Violations/ViolationsUtils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/Violations/ViolationsUtils.ts b/src/libs/Violations/ViolationsUtils.ts index b668b58a91f4..6153ea62cd0d 100644 --- a/src/libs/Violations/ViolationsUtils.ts +++ b/src/libs/Violations/ViolationsUtils.ts @@ -54,10 +54,10 @@ const ViolationsUtils = { // At the moment, we only return violations for tags for workspaces with single-level tags if (policyTagKeys.length === 1) { - const policyTagListName = Object.keys(policyTagList)[0]; + const policyTagListName = policyTagKeys[0]; const policyTags = policyTagList[policyTagListName]?.tags; - const hasTagOutOfPolicyViolation = transactionViolations.some((violation) => violation.name === 'tagOutOfPolicy'); - const hasMissingTagViolation = transactionViolations.some((violation) => violation.name === 'missingTag'); + const hasTagOutOfPolicyViolation = transactionViolations.some((violation) => violation.name === CONST.VIOLATIONS.TAG_OUT_OF_POLICY); + const hasMissingTagViolation = transactionViolations.some((violation) => violation.name === CONST.VIOLATIONS.MISSING_TAG); const isTagInPolicy = policyTags ? !!policyTags[updatedTransaction.tag ?? '']?.enabled : false; // Add 'tagOutOfPolicy' violation if tag is not in policy