Skip to content

Commit

Permalink
Merge pull request #44221 from Krishna2323/krishna2323/issue/43851
Browse files Browse the repository at this point in the history
fix: QBO - Confirmation page still shows tag field when all subtags are disabled.
  • Loading branch information
Beamanator authored Jul 4, 2024
2 parents 58be9ba + 0079d1c commit a84f68e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/components/MoneyRequestConfirmationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,7 @@ function MoneyRequestConfirmationList({
isTypeInvoice={isTypeInvoice}
onToggleBillable={onToggleBillable}
policy={policy}
policyTags={policyTags}
policyTagLists={policyTagLists}
rate={rate}
receiptFilename={receiptFilename}
Expand Down
10 changes: 8 additions & 2 deletions src/components/MoneyRequestConfirmationListFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ type MoneyRequestConfirmationListFooterProps = {
/** The policy */
policy: OnyxEntry<OnyxTypes.Policy>;

/** The policy tag lists */
policyTags: OnyxEntry<OnyxTypes.PolicyTagList>;

/** The policy tag lists */
policyTagLists: Array<ValueOf<OnyxTypes.PolicyTagList>>;

Expand Down Expand Up @@ -193,6 +196,7 @@ function MoneyRequestConfirmationListFooter({
isTypeInvoice,
onToggleBillable,
policy,
policyTags,
policyTagLists,
rate,
receiptFilename,
Expand Down Expand Up @@ -226,6 +230,7 @@ function MoneyRequestConfirmationListFooter({
// A flag for showing the tags field
// TODO: remove the !isTypeInvoice from this condition after BE supports tags for invoices: https://github.com/Expensify/App/issues/41281
const shouldShowTags = useMemo(() => isPolicyExpenseChat && OptionsListUtils.hasEnabledTags(policyTagLists) && !isTypeInvoice, [isPolicyExpenseChat, isTypeInvoice, policyTagLists]);
const isMultilevelTags = useMemo(() => PolicyUtils.isMultiLevelTags(policyTags), [policyTags]);

const senderWorkspace = useMemo(() => {
const senderWorkspaceParticipant = selectedParticipants.find((participant) => participant.isSender);
Expand Down Expand Up @@ -437,8 +442,9 @@ function MoneyRequestConfirmationListFooter({
shouldShow: shouldShowCategories,
isSupplementary: action === CONST.IOU.ACTION.CATEGORIZE ? false : !isCategoryRequired,
},
...policyTagLists.map(({name, required}, index) => {
...policyTagLists.map(({name, required, tags}, index) => {
const isTagRequired = required ?? false;
const shouldShow = shouldShowTags && (!isMultilevelTags || OptionsListUtils.hasEnabledOptions(tags));
return {
item: (
<MenuItemWithTopDescription
Expand All @@ -458,7 +464,7 @@ function MoneyRequestConfirmationListFooter({
rightLabel={isTagRequired && canUseViolations ? translate('common.required') : ''}
/>
),
shouldShow: shouldShowTags,
shouldShow,
isSupplementary: !isTagRequired,
};
}),
Expand Down

0 comments on commit a84f68e

Please sign in to comment.