Commit f5ae1f34 authored by Akinwale Ariwodola's avatar Akinwale Ariwodola
Browse files

resolved search nsfw

parent bf7f8364
......@@ -7067,8 +7067,8 @@
}
},
"lbry-redux": {
"version": "github:lbryio/lbry-redux#c910cd2b80b165843a81fdf6ce96094429b94ec8",
"from": "github:lbryio/lbry-redux#c910cd2b80b165843a81fdf6ce96094429b94ec8",
"version": "github:lbryio/lbry-redux#acbbc66b78566da11faa0fa8c65b44a8d4302c5e",
"from": "github:lbryio/lbry-redux#acbbc66b78566da11faa0fa8c65b44a8d4302c5e",
"requires": {
"proxy-polyfill": "0.1.6",
"reselect": "^3.0.0",
......
......@@ -12,11 +12,11 @@ import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import ClaimList from './view';
const select = state => ({
showNsfwContent: selectShowNsfw(state),
claimSearchByQuery: selectClaimSearchByQuery(state),
lastPageReached: selectClaimSearchByQueryLastPageReached(state),
loadingByQuery: selectFetchingClaimSearchByQuery(state),
loading: selectFetchingClaimSearch(state),
showNsfwContent: selectShowNsfw(state),
});
const perform = dispatch => ({
......@@ -25,5 +25,5 @@ const perform = dispatch => ({
export default connect(
select,
perform
perform,
)(ClaimList);
......@@ -7,6 +7,7 @@ import {
selectResolvingUris,
selectIsSearching,
} from 'lbry-redux';
import { selectShowNsfw } from 'redux/selectors/settings';
import RelatedContent from './view';
const RESULT_SIZE = 16;
......@@ -16,12 +17,13 @@ const select = (state, props) => ({
isSearching: selectIsSearching(state),
recommendedContent: makeSelectResolvedRecommendedContentForUri(props.uri, RESULT_SIZE)(state),
resolvingUris: selectResolvingUris(state),
showNsfwContent: selectShowNsfw(state),
});
const perform = dispatch => ({
resolveUris: uris => dispatch(doResolveUris(uris)),
searchRecommended: (query, claimId) =>
dispatch(doResolvedSearch(query, RESULT_SIZE, undefined, true, { related_to: claimId }, false)),
searchRecommended: (query, claimId, nsfw) =>
dispatch(doResolvedSearch(query, RESULT_SIZE, undefined, true, { related_to: claimId }, nsfw)),
});
export default connect(
......
......@@ -10,9 +10,9 @@ import relatedContentStyle from 'styles/relatedContent';
export default class RelatedContent extends React.PureComponent {
componentDidMount() {
const { title, claimId, searchRecommended } = this.props;
const { title, claimId, searchRecommended, showNsfwContent } = this.props;
if (title && claimId) {
searchRecommended(title, claimId);
searchRecommended(title, claimId, showNsfwContent);
}
}
......
......@@ -15,6 +15,7 @@ import {
} from 'lbry-redux';
import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
import { selectCurrentRoute } from 'redux/selectors/drawer';
import { selectShowNsfw } from 'redux/selectors/settings';
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
import SearchPage from './view';
......@@ -24,6 +25,7 @@ const select = state => ({
isSearching: selectIsSearching(state),
query: selectSearchValue(state),
resolvingUris: selectResolvingUris(state),
showNsfwContent: selectShowNsfw(state),
uris: makeSelectSearchUris(makeSelectQueryWithOptions(null, Constants.DEFAULT_PAGE_SIZE)(state))(state),
results: makeSelectResolvedSearchResults(makeSelectQueryWithOptions(null, Constants.DEFAULT_PAGE_SIZE)(state))(state),
lastPageReached: makeSelectResolvedSearchResultsLastPageReached(
......@@ -32,7 +34,7 @@ const select = state => ({
});
const perform = dispatch => ({
search: (query, from) => dispatch(doResolvedSearch(query, Constants.DEFAULT_PAGE_SIZE, from, false, {})),
search: (query, from, nsfw) => dispatch(doResolvedSearch(query, Constants.DEFAULT_PAGE_SIZE, from, false, {}, nsfw)),
claimSearch: options => dispatch(doClaimSearch(options)),
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)),
pushDrawerStack: (routeName, params) => dispatch(doPushDrawerStack(routeName, params)),
......
......@@ -52,7 +52,7 @@ class SearchPage extends React.PureComponent {
}
onComponentFocused = () => {
const { pushDrawerStack, setPlayerVisible, navigation, query, search } = this.props;
const { pushDrawerStack, setPlayerVisible, navigation, query, search, showNsfwContent } = this.props;
setPlayerVisible();
pushDrawerStack(Constants.DRAWER_ROUTE_SEARCH, navigation.state.params ? navigation.state.params : null);
NativeModules.Firebase.setCurrentScreen('Search').then(result => {
......@@ -68,7 +68,7 @@ class SearchPage extends React.PureComponent {
resultsResolved: false,
tagResultDisplayed: false,
});
search(searchQuery, 0);
search(searchQuery, 0, showNsfwContent);
}
});
};
......@@ -79,7 +79,7 @@ class SearchPage extends React.PureComponent {
componentWillReceiveProps(nextProps) {
const { currentRoute, query, isSearching } = nextProps;
const { currentRoute: prevRoute, search, isSearching: prevIsSearching } = this.props;
const { currentRoute: prevRoute, search, isSearching: prevIsSearching, showNsfwContent } = this.props;
if (Constants.DRAWER_ROUTE_SEARCH === currentRoute && currentRoute !== prevRoute) {
this.onComponentFocused();
......@@ -93,7 +93,7 @@ class SearchPage extends React.PureComponent {
resultsResolved: false,
tagResultDisplayed: false,
});
search(query, 0);
search(query, 0, showNsfwContent);
}
}
......@@ -136,7 +136,7 @@ class SearchPage extends React.PureComponent {
}
handleSearchSubmitted = keywords => {
const { search } = this.props;
const { search, showNsfwContent } = this.props;
this.setState({
currentUri: isURIValid(keywords) ? normalizeURI(keywords) : null,
currentFrom: 0,
......@@ -147,7 +147,7 @@ class SearchPage extends React.PureComponent {
resultsResolved: false,
tagResultDisplayed: false,
});
search(keywords, 0);
search(keywords, 0, showNsfwContent);
};
listEmptyComponent = () => {
......@@ -195,7 +195,7 @@ class SearchPage extends React.PureComponent {
handleVerticalEndReached = () => {
// fetch more results
const { lastPageReached, results, search, isSearching } = this.props;
const { lastPageReached, results, search, showNsfwContent, isSearching } = this.props;
if (lastPageReached || (results && results.length > softLimit)) {
return;
}
......@@ -203,7 +203,7 @@ class SearchPage extends React.PureComponent {
if (!isSearching) {
const from = results ? results.length : 0;
this.setState({ currentFrom: from }, () => {
search(this.state.currentQuery, from);
search(this.state.currentQuery, from, showNsfwContent);
});
}
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment