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

Correctly display workspace chats in recents when creating a new request #19373

Merged
merged 3 commits into from
May 26, 2023
Merged
Show file tree
Hide file tree
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
9 changes: 5 additions & 4 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -650,16 +650,17 @@ function getOptions(
if (includeRecentReports) {
for (let i = 0; i < allReportOptions.length; i++) {
const reportOption = allReportOptions[i];
const isCurrentUserOwnedPolicyExpenseChatThatShouldShow =
reportOption.isPolicyExpenseChat && reportOption.ownerEmail === currentUserLogin && includeOwnedWorkspaceChats && !reportOption.isArchivedRoom;

// Stop adding options to the recentReports array when we reach the maxRecentReportsToShow value
if (!isCurrentUserOwnedPolicyExpenseChatThatShouldShow && recentReportOptions.length > 0 && recentReportOptions.length === maxRecentReportsToShow) {
if (recentReportOptions.length > 0 && recentReportOptions.length === maxRecentReportsToShow) {
break;
}

const isCurrentUserOwnedPolicyExpenseChatThatCouldShow =
reportOption.isPolicyExpenseChat && reportOption.ownerEmail === currentUserLogin && includeOwnedWorkspaceChats && !reportOption.isArchivedRoom;

// Skip if we aren't including multiple participant reports and this report has multiple participants
if (!isCurrentUserOwnedPolicyExpenseChatThatShouldShow && !includeMultipleParticipantReports && !reportOption.login) {
if (!isCurrentUserOwnedPolicyExpenseChatThatCouldShow && !includeMultipleParticipantReports && !reportOption.login) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ class MoneyRequestParticipantsSelector extends Component {
CONST.EXPENSIFY_EMAILS,

// If we are using this component in the "Request money" flow then we pass the includeOwnedWorkspaceChats argument so that the current user
// sees the option to request money from their admin on their own Workspace Chat. These will always be shown in the "Recents" section of the selector
// along with any other recent chats.
// sees the option to request money from their admin on their own Workspace Chat.
this.props.iouType === CONST.IOU.MONEY_REQUEST_TYPE.REQUEST,
);
}
Expand Down