Merge pull request #155 from zxawry/search-view

set correct suggestion type for lbry URIs
This commit is contained in:
Sean Yesmunt 2019-06-12 15:59:27 -04:00 committed by GitHub
commit 9c27201373
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -57,20 +57,21 @@ export const selectSearchSuggestions: Array<SearchSuggestion> = createSelector(
return [];
}
const queryIsPrefix = query === 'lbry:' || query === 'lbry:/' || query === 'lbry://';
const queryIsPrefix =
query === 'lbry:' || query === 'lbry:/' || query === 'lbry://' || query === 'lbry://@';
if (query.startsWith('lbry://') && query !== 'lbry://') {
if (queryIsPrefix) {
// If it is a prefix, wait until something else comes to figure out what to do
return [];
} else if (query.startsWith('lbry://')) {
// If it starts with a prefix, don't show any autocomplete results
// They are probably typing/pasting in a lbry uri
return [
{
value: query,
type: SEARCH_TYPES.FILE,
type: query[7] === '@' ? SEARCH_TYPES.CHANNEL : SEARCH_TYPES.FILE,
},
];
} else if (queryIsPrefix) {
// If it is a prefix, wait until something else comes to figure out what to do
return [];
}
let searchSuggestions = [];