Merge pull request #281 from lbryio/mobile-related-content-fix
fix selector for resolved related content
This commit is contained in:
commit
2c2ac7130a
3 changed files with 26 additions and 30 deletions
16
dist/bundle.es.js
vendored
16
dist/bundle.es.js
vendored
|
@ -1120,11 +1120,13 @@ const getSearchQueryString = (query, options = {}) => {
|
||||||
|
|
||||||
if (includeUserOptions) {
|
if (includeUserOptions) {
|
||||||
const claimType = options[SEARCH_OPTIONS.CLAIM_TYPE];
|
const claimType = options[SEARCH_OPTIONS.CLAIM_TYPE];
|
||||||
queryParams.push(`claimType=${claimType}`);
|
if (claimType) {
|
||||||
|
queryParams.push(`claimType=${claimType}`);
|
||||||
|
|
||||||
// If they are only searching for channels, strip out the media info
|
// If they are only searching for channels, strip out the media info
|
||||||
if (!claimType.includes(SEARCH_OPTIONS.INCLUDE_CHANNELS)) {
|
if (!claimType.includes(SEARCH_OPTIONS.INCLUDE_CHANNELS)) {
|
||||||
queryParams.push(`mediaType=${[SEARCH_OPTIONS.MEDIA_FILE, SEARCH_OPTIONS.MEDIA_AUDIO, SEARCH_OPTIONS.MEDIA_VIDEO, SEARCH_OPTIONS.MEDIA_TEXT, SEARCH_OPTIONS.MEDIA_IMAGE, SEARCH_OPTIONS.MEDIA_APPLICATION].reduce((acc, currentOption) => options[currentOption] ? `${acc}${currentOption},` : acc, '')}`);
|
queryParams.push(`mediaType=${[SEARCH_OPTIONS.MEDIA_FILE, SEARCH_OPTIONS.MEDIA_AUDIO, SEARCH_OPTIONS.MEDIA_VIDEO, SEARCH_OPTIONS.MEDIA_TEXT, SEARCH_OPTIONS.MEDIA_IMAGE, SEARCH_OPTIONS.MEDIA_APPLICATION].reduce((acc, currentOption) => options[currentOption] ? `${acc}${currentOption},` : acc, '')}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2395,13 +2397,9 @@ const makeSelectResolvedRecommendedContentForUri = (uri, size) => reselect.creat
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const options = { related_to: claim.claim_id, isBackgroundSearch: true };
|
const options = { related_to: claim.claim_id, size, isBackgroundSearch: false };
|
||||||
if (!isMature) {
|
|
||||||
options['nsfw'] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const searchQuery = getSearchQueryString(title.replace(/\//, ' '), options);
|
const searchQuery = getSearchQueryString(title.replace(/\//, ' '), options);
|
||||||
|
|
||||||
let results = resolvedResultsByQuery[searchQuery];
|
let results = resolvedResultsByQuery[searchQuery];
|
||||||
if (results) {
|
if (results) {
|
||||||
results = results.filter(result => buildURI({ streamClaimId: result.claimId, streamName: result.name }) !== currentUri);
|
results = results.filter(result => buildURI({ streamClaimId: result.claimId, streamName: result.name }) !== currentUri);
|
||||||
|
|
|
@ -701,13 +701,9 @@ export const makeSelectResolvedRecommendedContentForUri = (uri: string, size: nu
|
||||||
related_to?: string,
|
related_to?: string,
|
||||||
nsfw?: boolean,
|
nsfw?: boolean,
|
||||||
isBackgroundSearch?: boolean,
|
isBackgroundSearch?: boolean,
|
||||||
} = { related_to: claim.claim_id, isBackgroundSearch: true };
|
} = { related_to: claim.claim_id, size, isBackgroundSearch: false };
|
||||||
if (!isMature) {
|
|
||||||
options['nsfw'] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const searchQuery = getSearchQueryString(title.replace(/\//, ' '), options);
|
const searchQuery = getSearchQueryString(title.replace(/\//, ' '), options);
|
||||||
|
|
||||||
let results = resolvedResultsByQuery[searchQuery];
|
let results = resolvedResultsByQuery[searchQuery];
|
||||||
if (results) {
|
if (results) {
|
||||||
results = results.filter(
|
results = results.filter(
|
||||||
|
|
|
@ -48,23 +48,25 @@ export const getSearchQueryString = (
|
||||||
|
|
||||||
if (includeUserOptions) {
|
if (includeUserOptions) {
|
||||||
const claimType = options[SEARCH_OPTIONS.CLAIM_TYPE];
|
const claimType = options[SEARCH_OPTIONS.CLAIM_TYPE];
|
||||||
queryParams.push(`claimType=${claimType}`);
|
if (claimType) {
|
||||||
|
queryParams.push(`claimType=${claimType}`);
|
||||||
|
|
||||||
// If they are only searching for channels, strip out the media info
|
// If they are only searching for channels, strip out the media info
|
||||||
if (!claimType.includes(SEARCH_OPTIONS.INCLUDE_CHANNELS)) {
|
if (!claimType.includes(SEARCH_OPTIONS.INCLUDE_CHANNELS)) {
|
||||||
queryParams.push(
|
queryParams.push(
|
||||||
`mediaType=${[
|
`mediaType=${[
|
||||||
SEARCH_OPTIONS.MEDIA_FILE,
|
SEARCH_OPTIONS.MEDIA_FILE,
|
||||||
SEARCH_OPTIONS.MEDIA_AUDIO,
|
SEARCH_OPTIONS.MEDIA_AUDIO,
|
||||||
SEARCH_OPTIONS.MEDIA_VIDEO,
|
SEARCH_OPTIONS.MEDIA_VIDEO,
|
||||||
SEARCH_OPTIONS.MEDIA_TEXT,
|
SEARCH_OPTIONS.MEDIA_TEXT,
|
||||||
SEARCH_OPTIONS.MEDIA_IMAGE,
|
SEARCH_OPTIONS.MEDIA_IMAGE,
|
||||||
SEARCH_OPTIONS.MEDIA_APPLICATION,
|
SEARCH_OPTIONS.MEDIA_APPLICATION,
|
||||||
].reduce(
|
].reduce(
|
||||||
(acc, currentOption) => (options[currentOption] ? `${acc}${currentOption},` : acc),
|
(acc, currentOption) => (options[currentOption] ? `${acc}${currentOption},` : acc),
|
||||||
''
|
''
|
||||||
)}`
|
)}`
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue