Merge pull request #70 from lbryio/trim-search

trim "/" from search query
This commit is contained in:
Sean Yesmunt 2018-08-24 11:09:11 -04:00 committed by GitHub
commit ccda4117ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 31 deletions

71
dist/bundle.js vendored
View file

@ -46,19 +46,34 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
@ -2498,26 +2513,26 @@ exports.default = lbryProxy;
/* 8 */
/***/ (function(module, exports) {
var g;
// This works in non-strict mode
g = (function() {
return this;
})();
try {
// This works if eval is allowed (see CSP)
g = g || Function("return this")() || (1, eval)("this");
} catch (e) {
// This works if the window reference is available
if (typeof window === "object") g = window;
}
// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module.exports = g;
var g;
// This works in non-strict mode
g = (function() {
return this;
})();
try {
// This works if eval is allowed (see CSP)
g = g || Function("return this")() || (1, eval)("this");
} catch (e) {
// This works if the window reference is available
if (typeof window === "object") g = window;
}
// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module.exports = g;
/***/ }),
@ -3302,7 +3317,7 @@ var makeSelectRecommendedContentForUri = exports.makeSelectRecommendedContentFor
if (claim) {
var title = claim.value.stream.metadata.title;
var searchUris = searchUrisByQuery[title];
var searchUris = searchUrisByQuery[title.replace(/\//, ' ')];
if (searchUris) {
searchUris = searchUris.filter(function (searchUri) {
return searchUri !== uri;
@ -3750,7 +3765,7 @@ var makeSelectSearchUris = exports.makeSelectSearchUris = function makeSelectSea
return (
// replace statement below is kind of ugly, and repeated in doSearch action
(0, _reselect.createSelector)(selectSearchUrisByQuery, function (byQuery) {
return byQuery[query ? query.replace(/^lbry:\/\//i, '') : query];
return byQuery[query ? query.replace(/^lbry:\/\//i, '').replace(/\//, ' ') : query];
})
);
};
@ -4295,7 +4310,7 @@ var doSearch = exports.doSearch = function doSearch(rawQuery) {
var isBackgroundSearch = arguments[3];
return function (dispatch, getState) {
var state = getState();
var query = rawQuery.replace(/^lbry:\/\//i, '');
var query = rawQuery.replace(/^lbry:\/\//i, '').replace(/\//, ' ');
if (!query) {
dispatch({

View file

@ -16,7 +16,7 @@ export const doSearch = (
isBackgroundSearch
) => (dispatch, getState) => {
const state = getState();
const query = rawQuery.replace(/^lbry:\/\//i, '');
const query = rawQuery.replace(/^lbry:\/\//i, '').replace(/\//, ' ');
if (!query) {
dispatch({

View file

@ -277,7 +277,7 @@ export const makeSelectRecommendedContentForUri = uri =>
},
},
} = claim;
let searchUris = searchUrisByQuery[title];
let searchUris = searchUrisByQuery[title.replace(/\//, ' ')];
if (searchUris) {
searchUris = searchUris.filter(searchUri => searchUri !== uri);
recommendedContent = searchUris;

View file

@ -23,7 +23,7 @@ export const makeSelectSearchUris = query =>
// replace statement below is kind of ugly, and repeated in doSearch action
createSelector(
selectSearchUrisByQuery,
byQuery => byQuery[query ? query.replace(/^lbry:\/\//i, '') : query]
byQuery => byQuery[query ? query.replace(/^lbry:\/\//i, '').replace(/\//, ' ') : query]
);
export const selectWunderBarAddress = createSelector(