Skip to content
Merged
Changes from all 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 in order to not mark 1:1 chats as having multiple participants
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 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