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

Hide the search results banner if a repo: field is present on sg.com #5142

Merged
merged 3 commits into from
Aug 9, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion web/src/search/results/SearchResultsInfoBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ interface SearchResultsInfoBarProps {
didSave: boolean

displayPerformanceWarning: boolean

// Whether the search query contains a repo: field.
hasRepoishField: boolean
}

/**
Expand Down Expand Up @@ -149,7 +152,7 @@ export const SearchResultsInfoBar: React.FunctionComponent<SearchResultsInfoBarP
</div>
</small>
)}
{!props.results.alert && props.showDotComMarketing && <ServerBanner />}
{!props.results.alert && props.showDotComMarketing && !props.hasRepoishField && <ServerBanner />}
Copy link
Contributor

Choose a reason for hiding this comment

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

Oops, I didn't review this carefully enough (I was on my phone, sorry). I think it would be better to not hide the banner, but instead change the message (to what it was before) if there is a repo: or repogroup: param (as I described in #5097 (comment)).

{!props.results.alert && props.displayPerformanceWarning && <PerformanceWarningAlert />}
</div>
)
7 changes: 7 additions & 0 deletions web/src/search/results/SearchResultsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,13 @@ export class SearchResultsList extends React.PureComponent<SearchResultsListProp
onShowMoreResultsClick={this.props.onShowMoreResultsClick}
showDotComMarketing={this.props.isSourcegraphDotCom}
displayPerformanceWarning={this.state.displayPerformanceWarning}
// This isn't always correct, but the penalty for a false-positive is
// low.
hasRepoishField={
parsedQuery
? parsedQuery.includes('repo:') || parsedQuery.includes('repogroup:')
: false
}
/>

{/* Results */}
Expand Down