pass nsfw=false to lighthouse searches
This commit is contained in:
parent
0bed38af91
commit
7f0fd02ffc
10 changed files with 41 additions and 16 deletions
|
@ -3,7 +3,7 @@
|
|||
"ui/**/*.{js,jsx,scss,json}": ["prettier --write", "git add"],
|
||||
"lbrytv/**/*.{js,jsx,scss,json}": ["prettier --write", "git add"],
|
||||
"ui/**/*.{js,jsx}": ["eslint", "flow focus-check --color always", "git add"],
|
||||
"lbrytv/**/*.{js,jsx,scss,json}": ["eslint", "git add"]
|
||||
"lbrytv/**/*.{js,jsx,scss}": ["eslint", "git add"]
|
||||
},
|
||||
"ignore": ["node_modules", "dist", "package-lock.json"]
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
"koa-logger": "^3.2.1",
|
||||
"koa-send": "^5.0.0",
|
||||
"koa-static": "^5.0.0",
|
||||
"lbry-redux": "lbryio/lbry-redux#4491b975cc3e23bf3733272b7c6079a28c1036b3",
|
||||
"lbry-redux": "lbryio/lbry-redux#2faf5293d6986ca043d422b1a6d7b7ac2a7a1406",
|
||||
"mysql": "^2.17.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -3333,9 +3333,9 @@ latest-version@^3.0.0:
|
|||
dependencies:
|
||||
package-json "^4.0.0"
|
||||
|
||||
lbry-redux@lbryio/lbry-redux#4491b975cc3e23bf3733272b7c6079a28c1036b3:
|
||||
lbry-redux@lbryio/lbry-redux#2faf5293d6986ca043d422b1a6d7b7ac2a7a1406:
|
||||
version "0.0.1"
|
||||
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/4491b975cc3e23bf3733272b7c6079a28c1036b3"
|
||||
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/2faf5293d6986ca043d422b1a6d7b7ac2a7a1406"
|
||||
dependencies:
|
||||
proxy-polyfill "0.1.6"
|
||||
reselect "^3.0.0"
|
||||
|
|
|
@ -130,7 +130,7 @@
|
|||
"imagesloaded": "^4.1.4",
|
||||
"json-loader": "^0.5.4",
|
||||
"lbry-format": "https://github.com/lbryio/lbry-format.git",
|
||||
"lbry-redux": "lbryio/lbry-redux#cda1f431b7463aaa74edff5ee9565ca8e935d607",
|
||||
"lbry-redux": "lbryio/lbry-redux#2faf5293d6986ca043d422b1a6d7b7ac2a7a1406",
|
||||
"lbryinc": "lbryio/lbryinc#6a59102c52673502569d2c43bd4ee58c315fb2e4",
|
||||
"lint-staged": "^7.0.2",
|
||||
"localforage": "^1.7.1",
|
||||
|
|
|
@ -1,15 +1,22 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri, doSearch, makeSelectRecommendedContentForUri, selectIsSearching } from 'lbry-redux';
|
||||
import {
|
||||
makeSelectClaimForUri,
|
||||
makeSelectClaimIsNsfw,
|
||||
doSearch,
|
||||
makeSelectRecommendedContentForUri,
|
||||
selectIsSearching,
|
||||
} from 'lbry-redux';
|
||||
import RecommendedVideos from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
mature: makeSelectClaimIsNsfw(props.uri)(state),
|
||||
recommendedContent: makeSelectRecommendedContentForUri(props.uri)(state),
|
||||
isSearching: selectIsSearching(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch, ownProps) => ({
|
||||
search: query => dispatch(doSearch(query, 20, undefined, true, { related_to: ownProps.claimId })),
|
||||
const perform = dispatch => ({
|
||||
search: (query, options) => dispatch(doSearch(query, 20, undefined, true, options)),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
|
|
|
@ -2,12 +2,19 @@
|
|||
import React from 'react';
|
||||
import ClaimList from 'component/claimList';
|
||||
|
||||
type Options = {
|
||||
related_to: string,
|
||||
nsfw?: boolean,
|
||||
};
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
claim: ?StreamClaim,
|
||||
claimId: string,
|
||||
recommendedContent: Array<string>,
|
||||
isSearching: boolean,
|
||||
search: string => void,
|
||||
search: (string, Options) => void,
|
||||
mature: boolean,
|
||||
};
|
||||
|
||||
export default class RecommendedContent extends React.PureComponent<Props> {
|
||||
|
@ -34,12 +41,16 @@ export default class RecommendedContent extends React.PureComponent<Props> {
|
|||
}
|
||||
|
||||
getRecommendedContent() {
|
||||
const { claim, search } = this.props;
|
||||
const { claim, search, mature, claimId } = this.props;
|
||||
|
||||
if (claim && claim.value && claim.value) {
|
||||
const options: Options = { related_to: claimId };
|
||||
if (claim && !mature) {
|
||||
options['nsfw'] = false;
|
||||
}
|
||||
const { title } = claim.value;
|
||||
if (title) {
|
||||
search(title);
|
||||
if (title && options) {
|
||||
search(title, options);
|
||||
this.didSearch = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ const select = (state, props) => ({
|
|||
channelIsBlocked: selectChannelIsBlocked(props.uri)(state),
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
supportOption: makeSelectClientSetting(settings.SUPPORT_OPTION)(state),
|
||||
showMature: makeSelectClientSetting(settings.SHOW_MATURE)(state),
|
||||
subCount: makeSelectSubCountForUri(props.uri)(state),
|
||||
});
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ type Props = {
|
|||
supportOption: boolean,
|
||||
fetchSubCount: string => void,
|
||||
subCount: number,
|
||||
showMature: boolean,
|
||||
};
|
||||
|
||||
function ChannelPage(props: Props) {
|
||||
|
@ -70,6 +71,7 @@ function ChannelPage(props: Props) {
|
|||
blackListedOutpoints,
|
||||
openModal,
|
||||
supportOption,
|
||||
showMature,
|
||||
fetchSubCount,
|
||||
subCount,
|
||||
} = props;
|
||||
|
@ -126,7 +128,11 @@ function ChannelPage(props: Props) {
|
|||
// In order to display original search results, search results must be set to null. A query of '' should display original results.
|
||||
return setSearchResults(null);
|
||||
} else {
|
||||
getResults(`${LIGHTHOUSE_URL}?s=${encodeURIComponent(searchQuery)}&channel_id=${encodeURIComponent(claimId)}`);
|
||||
getResults(
|
||||
`${LIGHTHOUSE_URL}?s=${encodeURIComponent(searchQuery)}&channel_id=${encodeURIComponent(claimId)}${
|
||||
!showMature ? '&nsfw=false' : ''
|
||||
}`
|
||||
);
|
||||
}
|
||||
}, DEBOUNCE_WAIT_DURATION_MS);
|
||||
return () => clearTimeout(timer);
|
||||
|
|
|
@ -7083,9 +7083,9 @@ lazy-val@^1.0.4:
|
|||
yargs "^13.2.2"
|
||||
zstd-codec "^0.1.1"
|
||||
|
||||
lbry-redux@lbryio/lbry-redux#cda1f431b7463aaa74edff5ee9565ca8e935d607:
|
||||
lbry-redux@lbryio/lbry-redux#2faf5293d6986ca043d422b1a6d7b7ac2a7a1406:
|
||||
version "0.0.1"
|
||||
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/cda1f431b7463aaa74edff5ee9565ca8e935d607"
|
||||
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/2faf5293d6986ca043d422b1a6d7b7ac2a7a1406"
|
||||
dependencies:
|
||||
proxy-polyfill "0.1.6"
|
||||
reselect "^3.0.0"
|
||||
|
|
Loading…
Reference in a new issue