Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix recent report is missing from the assignee list #41232

Merged
merged 4 commits into from
May 1, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions src/libs/OptionsListUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1455,8 +1455,18 @@ function createOptionList(personalDetails: OnyxEntry<PersonalDetailsList>, repor
}

const isSelfDM = ReportUtils.isSelfDM(report);
// Currently, currentUser is not included in participants, so for selfDM we need to add the currentUser as participants.
const accountIDs = isSelfDM ? [currentUserAccountID ?? 0] : Object.keys(report.participants ?? {}).map(Number);
let accountIDs = [];

if (isSelfDM) {
// For selfDM we need to add the currentUser as participants.
accountIDs = [currentUserAccountID ?? 0];
} else {
accountIDs = Object.keys(report.participants ?? {}).map(Number);
if (ReportUtils.isOneOnOneChat(report)) {
// For 1:1 chat, we don't want to include currentUser as participants
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// For 1:1 chat, we don't want to include currentUser as participants
// For 1:1 chat, we don't want to include currentUser as participants in order to not mark 1:1 chats as having multiple participants

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

accountIDs = accountIDs.filter(accountID => accountID !== currentUserAccountID);
}
}

if (!accountIDs || accountIDs.length === 0) {
return;
Expand Down Expand Up @@ -1676,8 +1686,18 @@ function getOptions(
const isPolicyExpenseChat = option.isPolicyExpenseChat;
const isMoneyRequestReport = option.isMoneyRequestReport;
const isSelfDM = option.isSelfDM;
// Currently, currentUser is not included in participants, so for selfDM we need to add the currentUser as participants.
const accountIDs = isSelfDM ? [currentUserAccountID ?? 0] : Object.keys(report.participants ?? {}).map(Number);
let accountIDs = [];

if (isSelfDM) {
// For selfDM we need to add the currentUser as participants.
accountIDs = [currentUserAccountID ?? 0];
} else {
accountIDs = Object.keys(report.participants ?? {}).map(Number);
if (ReportUtils.isOneOnOneChat(report)) {
// For 1:1 chat, we don't want to include currentUser as participants
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// For 1:1 chat, we don't want to include currentUser as participants
// For 1:1 chat, we don't want to include currentUser as participants in order to not mark 1:1 chats as having multiple participants

accountIDs = accountIDs.filter(accountID => accountID !== currentUserAccountID);
}
}

if (isPolicyExpenseChat && report.isOwnPolicyExpenseChat && !includeOwnedWorkspaceChats) {
return;
Expand Down
Loading