Skip to content

Commit

Permalink
Merge pull request #19117 from Expensify/georgia-makeThreadsSearchable
Browse files Browse the repository at this point in the history
Make Threads Searchable
  • Loading branch information
neil-marcellini authored May 25, 2023
2 parents 0f33e2c + 7ca93e5 commit 63f314c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/components/OptionRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ class OptionRow extends Component {
tooltipEnabled={this.props.showTitleTooltip}
numberOfLines={1}
textStyles={displayNameStyle}
shouldUseFullTitle={this.props.option.isChatRoom || this.props.option.isPolicyExpenseChat || this.props.option.isMoneyRequestReport}
shouldUseFullTitle={
this.props.option.isChatRoom || this.props.option.isPolicyExpenseChat || this.props.option.isMoneyRequestReport || this.props.option.isThread
}
/>
{this.props.option.alternateText ? (
<Text
Expand Down
14 changes: 11 additions & 3 deletions src/libs/OptionsListUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,10 @@ function uniqFast(items) {
* @param {String} reportName
* @param {Array} personalDetailList
* @param {Boolean} isChatRoomOrPolicyExpenseChat
* @param {Boolean} isThread
* @return {String}
*/
function getSearchText(report, reportName, personalDetailList, isChatRoomOrPolicyExpenseChat) {
function getSearchText(report, reportName, personalDetailList, isChatRoomOrPolicyExpenseChat, isThread) {
let searchTerms = [];

if (!isChatRoomOrPolicyExpenseChat) {
Expand All @@ -309,7 +310,13 @@ function getSearchText(report, reportName, personalDetailList, isChatRoomOrPolic
if (report) {
Array.prototype.push.apply(searchTerms, reportName.split(/[,\s]/));

if (isChatRoomOrPolicyExpenseChat) {
if (isThread) {
const title = ReportUtils.getReportName(report);
const chatRoomSubtitle = ReportUtils.getChatRoomSubtitle(report);

Array.prototype.push.apply(searchTerms, title.split(/[,\s]/));
Array.prototype.push.apply(searchTerms, chatRoomSubtitle.split(/[,\s]/));
} else if (isChatRoomOrPolicyExpenseChat) {
const chatRoomSubtitle = ReportUtils.getChatRoomSubtitle(report);

Array.prototype.push.apply(searchTerms, chatRoomSubtitle.split(/[,\s]/));
Expand Down Expand Up @@ -474,7 +481,7 @@ function createOption(logins, personalDetails, report, reportActions = {}, {show
}

result.text = reportName;
result.searchText = getSearchText(report, reportName, personalDetailList, result.isChatRoom || result.isPolicyExpenseChat);
result.searchText = getSearchText(report, reportName, personalDetailList, result.isChatRoom || result.isPolicyExpenseChat, result.isThread);
result.icons = ReportUtils.getIcons(report, personalDetails, ReportUtils.getAvatar(personalDetail.avatar, personalDetail.login));
result.subtitle = subtitle;

Expand Down Expand Up @@ -781,6 +788,7 @@ function getSearchOptions(reports, personalDetails, searchValue = '', betas) {
includePersonalDetails: true,
forcePolicyNamePreview: true,
includeOwnedWorkspaceChats: true,
includeThreads: true,
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/libs/SidebarUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ function getOptionData(reportID) {
result.participantsList = participantPersonalDetailList;

result.icons = ReportUtils.getIcons(result.isTaskReport ? parentReport : report, personalDetails, ReportUtils.getAvatar(personalDetail.avatar, personalDetail.login), true);
result.searchText = OptionsListUtils.getSearchText(report, reportName, participantPersonalDetailList, result.isChatRoom || result.isPolicyExpenseChat);
result.searchText = OptionsListUtils.getSearchText(report, reportName, participantPersonalDetailList, result.isChatRoom || result.isPolicyExpenseChat, result.isThread);
result.displayNamesWithTooltips = displayNamesWithTooltips;
return result;
}
Expand Down

0 comments on commit 63f314c

Please sign in to comment.