Skip to content

Commit

Permalink
Allow excluding group chat users from splits by setting amount to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
youssef-lr committed Apr 19, 2024
1 parent 2001821 commit f8116b3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3298,6 +3298,12 @@ function createSplitsAndOnyxData(
const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(participant);
const splitAmount = isPolicyExpenseChat ? IOUUtils.calculateAmount(participants.length, amount, currency, false) : splitShares[participant.accountID ?? 0].amount;

// To exclude someone from a split, the amount can be 0. The scenario for this is when creating a split from a group chat, we have remove the option to deselect users to exclude them.
// We can input '0' next to someone we want to exclude.
if (splitAmount === 0) {
return;
}

// In case the participant is a workspace, email & accountID should remain undefined and won't be used in the rest of this code
// participant.login is undefined when the request is initiated from a group DM with an unknown user, so we need to add a default
const email = isOwnPolicyExpenseChat || isPolicyExpenseChat ? '' : PhoneNumber.addSMSDomainIfPhoneNumber(participant.login ?? '').toLowerCase();
Expand Down

0 comments on commit f8116b3

Please sign in to comment.