diff --git a/lbrytv/package.json b/lbrytv/package.json index 73c09cf34..ecfcad4f2 100644 --- a/lbrytv/package.json +++ b/lbrytv/package.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#71e85536dbe397df98a47a3c4b4311760b2e7419", + "lbry-redux": "lbryio/lbry-redux#87ae7faf1c1d5ffa86feb578899596f6ea2a5fd9", "mysql": "^2.17.1" }, "devDependencies": { diff --git a/lbrytv/yarn.lock b/lbrytv/yarn.lock index 2637e8af4..6a29a13a2 100644 --- a/lbrytv/yarn.lock +++ b/lbrytv/yarn.lock @@ -3333,9 +3333,9 @@ latest-version@^3.0.0: dependencies: package-json "^4.0.0" -lbry-redux@lbryio/lbry-redux#71e85536dbe397df98a47a3c4b4311760b2e7419: +lbry-redux@lbryio/lbry-redux#87ae7faf1c1d5ffa86feb578899596f6ea2a5fd9: version "0.0.1" - resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/71e85536dbe397df98a47a3c4b4311760b2e7419" + resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/87ae7faf1c1d5ffa86feb578899596f6ea2a5fd9" dependencies: proxy-polyfill "0.1.6" reselect "^3.0.0" diff --git a/package.json b/package.json index 2c051d3bb..1c2dff560 100644 --- a/package.json +++ b/package.json @@ -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#bfbaa0dbdd2c1b2b340c0760d0d97c99f3cefb02", + "lbry-redux": "lbryio/lbry-redux#87ae7faf1c1d5ffa86feb578899596f6ea2a5fd9", "lbryinc": "lbryio/lbryinc#6a59102c52673502569d2c43bd4ee58c315fb2e4", "lint-staged": "^7.0.2", "localforage": "^1.7.1", diff --git a/static/app-strings.json b/static/app-strings.json index 13c3c5410..9e2a48e29 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -919,5 +919,7 @@ "Your wallet": "Your wallet", "Publish a file, or create a channel": "Publish a file, or create a channel", "Your account": "Your account", - "Channel profile picture": "Channel profile picture" + "Channel profile picture": "Channel profile picture", + "refreshing the app": "refreshing the app", + "Follower": "Follower" } diff --git a/ui/component/recommendedContent/index.js b/ui/component/recommendedContent/index.js index 54d1e2101..c8552cd0e 100644 --- a/ui/component/recommendedContent/index.js +++ b/ui/component/recommendedContent/index.js @@ -16,7 +16,7 @@ const select = (state, props) => ({ }); const perform = dispatch => ({ - search: (query, options) => dispatch(doSearch(query, 20, undefined, true, options)), + search: (query, options) => dispatch(doSearch(query, options)), }); export default connect( diff --git a/ui/component/recommendedContent/view.jsx b/ui/component/recommendedContent/view.jsx index cd73da06b..b14785ecc 100644 --- a/ui/component/recommendedContent/view.jsx +++ b/ui/component/recommendedContent/view.jsx @@ -44,7 +44,7 @@ export default class RecommendedContent extends React.PureComponent { const { claim, search, mature, claimId } = this.props; if (claim && claim.value && claim.value) { - const options: Options = { related_to: claimId }; + const options: Options = { size: 20, related_to: claimId, isBackgroundSearch: true }; if (claim && !mature) { options['nsfw'] = false; } diff --git a/ui/component/searchOptions/index.js b/ui/component/searchOptions/index.js index c829f0225..b9e4ef966 100644 --- a/ui/component/searchOptions/index.js +++ b/ui/component/searchOptions/index.js @@ -10,10 +10,13 @@ const select = state => ({ query: makeSelectQueryWithOptions()(state), }); -const perform = dispatch => ({ - setSearchOption: (option, value) => dispatch(doUpdateSearchOptions({ [option]: value })), - toggleSearchExpanded: () => dispatch(doToggleSearchExpanded()), -}); +const perform = (dispatch, ownProps) => { + const additionalOptions = ownProps.additionalOptions || {}; + return { + setSearchOption: (option, value) => dispatch(doUpdateSearchOptions({ [option]: value }, additionalOptions)), + toggleSearchExpanded: () => dispatch(doToggleSearchExpanded()), + }; +}; export default connect( select, diff --git a/ui/page/search/index.js b/ui/page/search/index.js index 144c8a76b..b4dc44f9c 100644 --- a/ui/page/search/index.js +++ b/ui/page/search/index.js @@ -1,15 +1,27 @@ import { connect } from 'react-redux'; +import * as SETTINGS from 'constants/settings'; import { doSearch, selectIsSearching, makeSelectSearchUris, makeSelectQueryWithOptions, doToast } from 'lbry-redux'; +import { makeSelectClientSetting } from 'redux/selectors/settings'; import analytics from 'analytics'; import SearchPage from './view'; -const select = state => ({ - isSearching: selectIsSearching(state), - uris: makeSelectSearchUris(makeSelectQueryWithOptions()(state))(state), -}); +const select = state => { + const showMature = makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state); + const query = makeSelectQueryWithOptions( + null, + showMature === false ? { nsfw: false, isBackgroundSearch: false } : { isBackgroundSearch: false } + )(state); + const uris = makeSelectSearchUris(query)(state); + + return { + isSearching: selectIsSearching(state), + showNsfw: makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state), + uris: uris, + }; +}; const perform = dispatch => ({ - search: query => dispatch(doSearch(query)), + search: (query, options) => dispatch(doSearch(query, options)), onFeedbackPositive: query => { analytics.apiSearchFeedback(query, 1); dispatch( diff --git a/ui/page/search/view.jsx b/ui/page/search/view.jsx index dc29a604d..ab6c0f573 100644 --- a/ui/page/search/view.jsx +++ b/ui/page/search/view.jsx @@ -9,19 +9,29 @@ import SearchOptions from 'component/searchOptions'; import Button from 'component/button'; import ClaimUri from 'component/claimUri'; +type AdditionalOptions = { + isBackgroundSearch: boolean, + nsfw?: boolean, +}; + type Props = { - search: string => void, + search: (string, AdditionalOptions) => void, isSearching: boolean, location: UrlLocation, uris: Array, onFeedbackNegative: string => void, onFeedbackPositive: string => void, + showNsfw: boolean, }; export default function SearchPage(props: Props) { - const { search, uris, onFeedbackPositive, onFeedbackNegative, location, isSearching } = props; + const { search, uris, onFeedbackPositive, onFeedbackNegative, location, isSearching, showNsfw } = props; const urlParams = new URLSearchParams(location.search); const urlQuery = urlParams.get('q'); + const additionalOptions: AdditionalOptions = { isBackgroundSearch: false }; + if (!showNsfw) { + additionalOptions['nsfw'] = false; + } let normalizedUri; let isUriValid; @@ -42,7 +52,7 @@ export default function SearchPage(props: Props) { useEffect(() => { if (urlQuery) { - search(urlQuery); + search(urlQuery, additionalOptions); } }, [search, urlQuery]); @@ -63,7 +73,7 @@ export default function SearchPage(props: Props) { } + header={} headerAltControls={ {__('Find what you were looking for?')} diff --git a/yarn.lock b/yarn.lock index 2ce345cf7..08f677b34 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7277,9 +7277,9 @@ lazy-val@^1.0.4: yargs "^13.2.2" zstd-codec "^0.1.1" -lbry-redux@lbryio/lbry-redux#bfbaa0dbdd2c1b2b340c0760d0d97c99f3cefb02: +lbry-redux@lbryio/lbry-redux#87ae7faf1c1d5ffa86feb578899596f6ea2a5fd9: version "0.0.1" - resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/bfbaa0dbdd2c1b2b340c0760d0d97c99f3cefb02" + resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/87ae7faf1c1d5ffa86feb578899596f6ea2a5fd9" dependencies: proxy-polyfill "0.1.6" reselect "^3.0.0"