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

Make Threads Searchable #19117

Merged
merged 5 commits into from
May 25, 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
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]/));
Copy link
Contributor

Choose a reason for hiding this comment

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

NAB A comment here would be nice to explain what we're doing with this regex

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