Skip to content

Commit

Permalink
Merge pull request Expensify#46851 from nkdengineer/fix/46775
Browse files Browse the repository at this point in the history
fix: User can write and send a message onboarding tasks
  • Loading branch information
stitesExpensify authored Aug 7, 2024
2 parents b806725 + 9da6141 commit d8a5aaa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5845,7 +5845,7 @@ function getChatByParticipants(newParticipantList: number[], reports: OnyxCollec
const participantAccountIDs = Object.keys(report?.participants ?? {});

// Skip if it's not a 1:1 chat
if (!shouldIncludeGroupChats && !isOneOnOneChat(report)) {
if (!shouldIncludeGroupChats && !isOneOnOneChat(report) && !isSystemChat(report)) {
return false;
}

Expand Down
4 changes: 4 additions & 0 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3232,6 +3232,9 @@ function completeOnboarding(
const isAccountIDOdd = AccountUtils.isAccountIDOddNumber(currentUserAccountID ?? 0);
const targetEmail = isAccountIDOdd ? CONST.EMAIL.NOTIFICATIONS : CONST.EMAIL.CONCIERGE;

// If the target report isn't opened, the permission field will not exist. So we should add the fallback permission for task report
const fallbackPermission = isAccountIDOdd ? [CONST.REPORT.PERMISSIONS.READ] : [CONST.REPORT.PERMISSIONS.READ, CONST.REPORT.PERMISSIONS.WRITE];

const actorAccountID = PersonalDetailsUtils.getAccountIDsByLogins([targetEmail])[0];
const targetChatReport = ReportUtils.getChatByParticipants([actorAccountID, currentUserAccountID]);
const {reportID: targetChatReportID = '', policyID: targetChatPolicyID = ''} = targetChatReport ?? {};
Expand Down Expand Up @@ -3347,6 +3350,7 @@ function completeOnboarding(
},
isOptimisticReport: true,
managerID: currentUserAccountID,
permissions: targetChatReport?.permissions ?? fallbackPermission,
},
},
{
Expand Down

0 comments on commit d8a5aaa

Please sign in to comment.