Skip to content

Commit

Permalink
Refactor code for cleaner condition
Browse files Browse the repository at this point in the history
  • Loading branch information
mountiny committed May 18, 2023
1 parent 4d41619 commit 326e0e4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/components/MoneyRequestHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,8 @@ const MoneyRequestHeader = (props) => {
? ReportUtils.getWorkspaceAvatar(moneyRequestReport)
: ReportUtils.getAvatar(lodashGet(props.personalDetails, [moneyRequestReport.managerEmail, 'avatar']), moneyRequestReport.managerEmail);
const policy = props.policies[`${ONYXKEYS.COLLECTION.POLICY}${props.report.policyID}`];
const shouldShowSettlementButton =
!isSettled &&
!props.isSingleTransactionView &&
(Policy.isAdminOfFreePolicy([policy]) || (ReportUtils.isMoneyRequestReport(props.report) && lodashGet(props.session, 'email', null) === props.report.managerEmail));
const isPayer = Policy.isAdminOfFreePolicy([policy]) || (ReportUtils.isMoneyRequestReport(props.report) && lodashGet(props.session, 'email', null) === props.report.managerEmail);
const shouldShowSettlementButton = !isSettled && !props.isSingleTransactionView && isPayer;
return (
<View style={[{backgroundColor: themeColors.highlightBG}, styles.pl0]}>
<HeaderWithCloseButton
Expand Down

0 comments on commit 326e0e4

Please sign in to comment.