Skip to content

Commit

Permalink
Hide the search results banner if a repo: field is present on sg.com (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ijt committed Aug 9, 2019
1 parent 1e08c48 commit 5c3d293
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
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 />}
{!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

0 comments on commit 5c3d293

Please sign in to comment.