diff --git a/package.json b/package.json index 69686bb50..3e7978aeb 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#ce642bbae6a4647e4be77586b6307d6069006776", + "lbry-redux": "lbryio/lbry-redux#17f611888c60b71910b5b984a05c5ef6eef4d5dc", "lbryinc": "lbryio/lbryinc#cc62a4eec10845cc0b31da7d0f27287cfa7c4866", "lint-staged": "^7.0.2", "localforage": "^1.7.1", diff --git a/static/app-strings.json b/static/app-strings.json index 4f0963fcc..1f659dcc9 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -1161,7 +1161,6 @@ "You have %count% blocked %channels%.": "You have %count% blocked %channels%.", "Account Password": "Account Password", "You do not currently have a password set.": "You do not currently have a password set.", - "Add A Password": "Add A Password", "Register with lbry.tv": "Register with lbry.tv", "Enter Your lbry.tv Password": "Enter Your lbry.tv Password", "Signing in as %email%": "Signing in as %email%", @@ -1191,6 +1190,9 @@ "There are no stats for this channel. Make sure you are signed in with the correct email and have data sharing turned on.": "There are no stats for this channel. Make sure you are signed in with the correct email and have data sharing turned on.", "%follower_count% followers": "%follower_count% followers", "%lbc_received% LBC Earned": "%lbc_received% LBC Earned", + "Sign Up": "Sign Up", "Earnings may also include any LBC you've sent yourself or added as support. We are working on making this more accurate. Check your wallet page for the correct total balance.": "Earnings may also include any LBC you've sent yourself or added as support. We are working on making this more accurate. Check your wallet page for the correct total balance.", - "Sign Up": "Sign Up" -} \ No newline at end of file + "Add A Password": "Add A Password", + "Hide reposts": "Hide reposts", + "You will not see reposts by people you follow or receive email notifying about them.": "You will not see reposts by people you follow or receive email notifying about them." +} diff --git a/ui/component/claimListDiscover/index.js b/ui/component/claimListDiscover/index.js index 6c621fe84..d59c1e816 100644 --- a/ui/component/claimListDiscover/index.js +++ b/ui/component/claimListDiscover/index.js @@ -16,7 +16,7 @@ const select = state => ({ claimSearchByQuery: selectClaimSearchByQuery(state), loading: selectFetchingClaimSearch(state), showNsfw: makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state), - showReposts: makeSelectClientSetting(SETTINGS.SHOW_REPOSTS)(state), + hideReposts: makeSelectClientSetting(SETTINGS.HIDE_REPOSTS)(state), hiddenUris: selectBlockedChannels(state), }); @@ -25,7 +25,4 @@ const perform = { doToggleTagFollowDesktop, }; -export default connect( - select, - perform -)(ClaimListDiscover); +export default connect(select, perform)(ClaimListDiscover); diff --git a/ui/component/claimListDiscover/view.jsx b/ui/component/claimListDiscover/view.jsx index db6caf019..4dd1d4879 100644 --- a/ui/component/claimListDiscover/view.jsx +++ b/ui/component/claimListDiscover/view.jsx @@ -23,7 +23,7 @@ type Props = { doToggleTagFollowDesktop: string => void, meta?: Node, showNsfw: boolean, - // showReposts: boolean, + hideReposts: boolean, history: { action: string, push: string => void, replace: string => void }, location: { search: string, pathname: string }, claimSearchByQuery: { @@ -66,7 +66,7 @@ function ClaimListDiscover(props: Props) { meta, channelIds, showNsfw, - // showReposts, + hideReposts, history, location, hiddenUris, @@ -247,13 +247,16 @@ function ClaimListDiscover(props: Props) { } } // https://github.com/lbryio/lbry-desktop/issues/3774 - // if (!showReposts) { - // if (Array.isArray(options.claim_type)) { - // options.claim_type = options.claim_type.filter(claimType => claimType !== 'repost'); - // } else { - // options.claim_type = ['stream', 'channel']; - // } - // } + if (hideReposts && !options.reposted_claim_id) { + // and not claimrepostid + if (Array.isArray(options.claim_type)) { + if (options.claim_type.length > 1) { + options.claim_type = options.claim_type.filter(claimType => claimType !== 'repost'); + } + } else { + options.claim_type = ['stream', 'channel']; + } + } const hasMatureTags = tagsParam && tagsParam.split(',').some(t => MATURE_TAGS.includes(t)); const claimSearchCacheQuery = createNormalizedClaimSearchKey(options); diff --git a/ui/component/claimTilesDiscover/index.js b/ui/component/claimTilesDiscover/index.js index 123f96b5e..bfd8b94b4 100644 --- a/ui/component/claimTilesDiscover/index.js +++ b/ui/component/claimTilesDiscover/index.js @@ -14,7 +14,7 @@ const select = state => ({ claimSearchByQuery: selectClaimSearchByQuery(state), loading: selectFetchingClaimSearch(state), showNsfw: makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state), - showReposts: makeSelectClientSetting(SETTINGS.SHOW_REPOSTS)(state), + hideReposts: makeSelectClientSetting(SETTINGS.HIDE_REPOSTS)(state), hiddenUris: selectBlockedChannels(state), }); @@ -23,7 +23,4 @@ const perform = { doToggleTagFollowDesktop, }; -export default connect( - select, - perform -)(ClaimListDiscover); +export default connect(select, perform)(ClaimListDiscover); diff --git a/ui/component/claimTilesDiscover/view.jsx b/ui/component/claimTilesDiscover/view.jsx index fa3d9eb80..6049d3eed 100644 --- a/ui/component/claimTilesDiscover/view.jsx +++ b/ui/component/claimTilesDiscover/view.jsx @@ -8,7 +8,7 @@ type Props = { uris: Array, doClaimSearch: ({}) => void, showNsfw: boolean, - showReposts: boolean, + hideReposts: boolean, history: { action: string, push: string => void, replace: string => void }, claimSearchByQuery: { [string]: Array, @@ -30,7 +30,7 @@ function ClaimTilesDiscover(props: Props) { doClaimSearch, claimSearchByQuery, showNsfw, - // showReposts, + hideReposts, hiddenUris, // Below are options to pass that are forwarded to claim_search tags, @@ -77,13 +77,13 @@ function ClaimTilesDiscover(props: Props) { } // https://github.com/lbryio/lbry-desktop/issues/3774 - // if (!showReposts) { - // if (Array.isArray(options.claim_type)) { - // options.claim_type = options.claim_type.filter(claimType => claimType !== 'repost'); - // } else { - // options.claim_type = ['stream', 'channel']; - // } - // } + if (hideReposts) { + if (Array.isArray(options.claim_type)) { + options.claim_type = options.claim_type.filter(claimType => claimType !== 'repost'); + } else { + options.claim_type = ['stream', 'channel']; + } + } if (claimType) { options.claim_type = claimType; diff --git a/ui/page/settings/index.js b/ui/page/settings/index.js index 554ebcc58..031ac45d7 100644 --- a/ui/page/settings/index.js +++ b/ui/page/settings/index.js @@ -44,7 +44,7 @@ const select = state => ({ userBlockedChannelsCount: selectBlockedChannelsCount(state), hideBalance: makeSelectClientSetting(SETTINGS.HIDE_BALANCE)(state), floatingPlayer: makeSelectClientSetting(SETTINGS.FLOATING_PLAYER)(state), - showReposts: makeSelectClientSetting(SETTINGS.SHOW_REPOSTS)(state), + hideReposts: makeSelectClientSetting(SETTINGS.HIDE_REPOSTS)(state), darkModeTimes: makeSelectClientSetting(SETTINGS.DARK_MODE_TIMES)(state), ffmpegStatus: selectFfmpegStatus(state), findingFFmpeg: selectFindingFFmpeg(state), @@ -65,7 +65,4 @@ const perform = dispatch => ({ findFFmpeg: () => dispatch(doFindFFmpeg()), }); -export default connect( - select, - perform -)(SettingsPage); +export default connect(select, perform)(SettingsPage); diff --git a/ui/page/settings/view.jsx b/ui/page/settings/view.jsx index ef55d500e..4404b7579 100644 --- a/ui/page/settings/view.jsx +++ b/ui/page/settings/view.jsx @@ -19,6 +19,7 @@ import Card from 'component/common/card'; import { getPasswordFromCookie } from 'util/saved-passwords'; import Spinner from 'component/spinner'; import SettingAccountPassword from 'component/settingAccountPassword'; +import { Lbryio } from 'lbryinc'; // @if TARGET='app' export const IS_MAC = process.platform === 'darwin'; @@ -78,7 +79,7 @@ type Props = { hideBalance: boolean, confirmForgetPassword: ({}) => void, floatingPlayer: boolean, - // showReposts: boolean, + hideReposts: boolean, clearPlayingUri: () => void, darkModeTimes: DarkModeTimes, setDarkTime: (string, {}) => void, @@ -240,7 +241,7 @@ class SettingsPage extends React.PureComponent { hideBalance, userBlockedChannelsCount, floatingPlayer, - // showReposts, + hideReposts, clearPlayingUri, darkModeTimes, clearCache, @@ -434,16 +435,21 @@ class SettingsPage extends React.PureComponent { /> {/* https://github.com/lbryio/lbry-desktop/issues/3774 */} - {/* { - setClientSetting(SETTINGS.SHOW_REPOSTS, !showReposts); + name="hide_reposts" + onChange={e => { + if (isAuthenticated) { + let param = e.target.checked ? { add: 'noreposts' } : { remove: 'noreposts' }; + Lbryio.call('user_tag', 'edit', param); + } + // $FlowFixMe could be undefined due to rehydrate + setClientSetting(SETTINGS.HIDE_REPOSTS, !Boolean(hideReposts)); }} - checked={showReposts} - label={__('Show reposts')} - helper={__('Show reposts from the creators you follow.')} - /> */} + checked={hideReposts} + label={__('Hide reposts')} + helper={__('You will not see reposts by people you follow or receive email notifying about them.')} + /> {/* state.settings || {}; -export const selectDaemonSettings = createSelector( - selectState, - state => state.daemonSettings -); +export const selectDaemonSettings = createSelector(selectState, state => state.daemonSettings); -export const selectDaemonStatus = createSelector( - selectState, - state => state.daemonStatus -); +export const selectDaemonStatus = createSelector(selectState, state => state.daemonStatus); -export const selectFfmpegStatus = createSelector( - selectDaemonStatus, - status => status.ffmpeg_status -); +export const selectFfmpegStatus = createSelector(selectDaemonStatus, status => status.ffmpeg_status); -export const selectFindingFFmpeg = createSelector( - selectState, - state => state.findingFFmpeg || false -); +export const selectFindingFFmpeg = createSelector(selectState, state => state.findingFFmpeg || false); -export const selectClientSettings = createSelector( - selectState, - state => state.clientSettings || {} -); +export const selectClientSettings = createSelector(selectState, state => state.clientSettings || {}); -export const selectLoadedLanguages = createSelector( - selectState, - state => state.loadedLanguages || {} -); +export const selectLoadedLanguages = createSelector(selectState, state => state.loadedLanguages || {}); export const makeSelectClientSetting = setting => - createSelector( - selectClientSettings, - settings => (settings ? settings[setting] : undefined) - ); + createSelector(selectClientSettings, settings => (settings ? settings[setting] : undefined)); // refactor me export const selectShowMatureContent = makeSelectClientSetting(LBRY_REDUX_SETTINGS.SHOW_MATURE); // and me -export const selectShowRepostedContent = makeSelectClientSetting(LBRY_REDUX_SETTINGS.SHOW_REPOSTS); +export const selectShowRepostedContent = makeSelectClientSetting(LBRY_REDUX_SETTINGS.HIDE_REPOSTS); export const selectTheme = makeSelectClientSetting(SETTINGS.THEME); export const selectAutomaticDarkModeEnabled = makeSelectClientSetting(SETTINGS.AUTOMATIC_DARK_MODE_ENABLED); -export const selectIsNight = createSelector( - selectState, - state => state.isNight -); +export const selectIsNight = createSelector(selectState, state => state.isNight); -export const selectSavedWalletServers = createSelector( - selectState, - state => state.customWalletServers -); +export const selectSavedWalletServers = createSelector(selectState, state => state.customWalletServers); -export const selectSharedPreferences = createSelector( - selectState, - state => state.sharedPreferences -); +export const selectSharedPreferences = createSelector(selectState, state => state.sharedPreferences); export const makeSelectSharedPreferencesForKey = key => - createSelector( - selectSharedPreferences, - prefs => (prefs ? prefs[key] : undefined) - ); + createSelector(selectSharedPreferences, prefs => (prefs ? prefs[key] : undefined)); export const selectHasWalletServerPrefs = createSelector( makeSelectSharedPreferencesForKey(SHARED_PREFERENCES.WALLET_SERVERS), diff --git a/yarn.lock b/yarn.lock index 03fdd0010..b0c0d0272 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6132,9 +6132,9 @@ lazy-val@^1.0.4: yargs "^13.2.2" zstd-codec "^0.1.1" -lbry-redux@lbryio/lbry-redux#ce642bbae6a4647e4be77586b6307d6069006776: +lbry-redux@lbryio/lbry-redux#17f611888c60b71910b5b984a05c5ef6eef4d5dc: version "0.0.1" - resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/ce642bbae6a4647e4be77586b6307d6069006776" + resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/17f611888c60b71910b5b984a05c5ef6eef4d5dc" dependencies: proxy-polyfill "0.1.6" reselect "^3.0.0"