Skip to content

Commit

Permalink
Merge pull request #19373 from Expensify/alberto-recent
Browse files Browse the repository at this point in the history
Correctly display workspace chats in recents when creating a new request
  • Loading branch information
grgia authored May 26, 2023
2 parents 0f1188d + 925fc3a commit 8e52cea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -657,16 +657,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

0 comments on commit 8e52cea

Please sign in to comment.