Compare commits

...

7 commits

Author SHA1 Message Date
Akinwale Ariwodola
7e2ed1f66e merge changes with master 2020-02-10 12:03:20 +01:00
Akinwale Ariwodola
acbbc66b78 add nsfw flag 2020-02-03 07:25:44 +01:00
Akinwale Ariwodola
28008a3463 resolve merge conflict 2020-01-22 02:03:38 +01:00
Akinwale Ariwodola
c910cd2b80 support for multiple pages of resolved search results 2020-01-08 09:09:45 +01:00
Akinwale Ariwodola
e8f29f1c47 update ResolvedSearchResult type 2020-01-05 17:56:08 +01:00
Akinwale Ariwodola
6ef2f9dde9 add recommended content selector 2020-01-05 13:40:48 +01:00
Akinwale Ariwodola
9250e0c451 add doResolvedSearch actions which returns resolved search results 2020-01-05 12:58:44 +01:00
2 changed files with 12 additions and 8 deletions

5
dist/bundle.es.js vendored
View file

@ -4112,7 +4112,7 @@ const doSearch = (rawQuery, searchOptions) => (dispatch, getState) => {
}; };
const doResolvedSearch = (rawQuery, size, // only pass in if you don't want to use the users setting (ex: related content) const doResolvedSearch = (rawQuery, size, // only pass in if you don't want to use the users setting (ex: related content)
from, isBackgroundSearch = false, options = {}) => (dispatch, getState) => { from, isBackgroundSearch = false, options = {}, nsfw) => (dispatch, getState) => {
const query = rawQuery.replace(/^lbry:\/\//i, '').replace(/\//, ' '); const query = rawQuery.replace(/^lbry:\/\//i, '').replace(/\//, ' ');
if (!query) { if (!query) {
@ -4155,7 +4155,8 @@ from, isBackgroundSearch = false, options = {}) => (dispatch, getState) => {
dispatch(doUpdateSearchQuery(query)); dispatch(doUpdateSearchQuery(query));
} }
fetch(`${CONNECTION_STRING}search?resolve=true&${queryWithOptions}`).then(handleFetchResponse).then(data => { const fetchUrl = nsfw ? `${CONNECTION_STRING}search?resolve=true&${queryWithOptions}` : `${CONNECTION_STRING}search?resolve=true&nsfw=false&${queryWithOptions}`;
fetch(fetchUrl).then(handleFetchResponse).then(data => {
const results = []; const results = [];
data.forEach(result => { data.forEach(result => {

View file

@ -166,13 +166,13 @@ export const doSearch = (rawQuery: string, searchOptions: SearchOptions) => (
export const doResolvedSearch = ( export const doResolvedSearch = (
rawQuery: string, rawQuery: string,
size?: number, // only pass in if you don't want to use the users setting (ex: related content) size: ?number, // only pass in if you don't want to use the users setting (ex: related content)
from?: number, from: ?number,
isBackgroundSearch?: boolean = false, isBackgroundSearch: boolean = false,
options: { options: {
related_to?: string, related_to?: string,
// nsfw here } = {},
} = {} nsfw: boolean
) => (dispatch: Dispatch, getState: GetState) => { ) => (dispatch: Dispatch, getState: GetState) => {
const query = rawQuery.replace(/^lbry:\/\//i, '').replace(/\//, ' '); const query = rawQuery.replace(/^lbry:\/\//i, '').replace(/\//, ' ');
@ -218,7 +218,10 @@ export const doResolvedSearch = (
dispatch(doUpdateSearchQuery(query)); dispatch(doUpdateSearchQuery(query));
} }
fetch(`${CONNECTION_STRING}search?resolve=true&${queryWithOptions}`) const fetchUrl = nsfw
? `${CONNECTION_STRING}search?resolve=true&${queryWithOptions}`
: `${CONNECTION_STRING}search?resolve=true&nsfw=false&${queryWithOptions}`;
fetch(fetchUrl)
.then(handleFetchResponse) .then(handleFetchResponse)
.then((data: Array<ResolvedSearchResult>) => { .then((data: Array<ResolvedSearchResult>) => {
const results = []; const results = [];