From 9c9530c6f3087cfcf8e90808ec24abec7ba45f0d Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 14 Jul 2020 19:22:44 -0400 Subject: [PATCH] Revert "bring in comments/blocked code from 'lbry-redux'" This reverts commit fa7f74f97946f09d5c1fe47af0acb9b811814f1f. --- package.json | 2 +- ui/component/abandonedChannelPreview/index.js | 2 +- ui/component/blockButton/index.js | 10 +++-- ui/component/channelContent/index.js | 2 +- ui/component/claimListDiscover/index.js | 2 +- ui/component/claimPreview/index.js | 3 +- ui/component/claimPreviewTile/index.js | 7 +++- ui/component/claimTilesDiscover/index.js | 9 ++++- ui/component/comment/index.js | 2 +- ui/constants/action_types.js | 3 -- ui/modal/modalRemoveBlocked/index.js | 3 +- ui/page/channel/index.js | 2 +- ui/page/channelsFollowingDiscover/index.js | 3 +- ui/page/listBlocked/index.js | 7 +++- ui/page/listBlocked/view.jsx | 12 +++--- ui/page/settings/index.js | 3 +- ui/reducers.js | 11 +++++- ui/redux/actions/blocked.js | 9 ----- ui/redux/reducers/blocked.js | 39 ------------------- ui/redux/selectors/blocked.js | 13 ------- yarn.lock | 4 +- 21 files changed, 53 insertions(+), 95 deletions(-) delete mode 100644 ui/redux/actions/blocked.js delete mode 100644 ui/redux/reducers/blocked.js delete mode 100644 ui/redux/selectors/blocked.js diff --git a/package.json b/package.json index bb95ab15d..f4dfe3649 100644 --- a/package.json +++ b/package.json @@ -136,7 +136,7 @@ "imagesloaded": "^4.1.4", "json-loader": "^0.5.4", "lbry-format": "https://github.com/lbryio/lbry-format.git", - "lbry-redux": "lbryio/lbry-redux#0ec72d09d438c60d25cc56d256df971a9d3b2c0a", + "lbry-redux": "lbryio/lbry-redux#a1673ebfa933c0e921a23a1877d22e21c2bff8f9", "lbryinc": "lbryio/lbryinc#cff5dd60934c4c6080e135f47ebbece1548c658c", "lint-staged": "^7.0.2", "localforage": "^1.7.1", diff --git a/ui/component/abandonedChannelPreview/index.js b/ui/component/abandonedChannelPreview/index.js index a401da12f..caec28e62 100644 --- a/ui/component/abandonedChannelPreview/index.js +++ b/ui/component/abandonedChannelPreview/index.js @@ -1,5 +1,5 @@ import { connect } from 'react-redux'; -import { selectBlockedChannels } from 'redux/selectors/blocked'; +import { selectBlockedChannels } from 'lbry-redux'; import { doChannelUnsubscribe } from 'redux/actions/subscriptions'; import { doOpenModal } from 'redux/actions/app'; import AbandonedChannelPreview from './view'; diff --git a/ui/component/blockButton/index.js b/ui/component/blockButton/index.js index 7ac0212bf..33653b277 100644 --- a/ui/component/blockButton/index.js +++ b/ui/component/blockButton/index.js @@ -1,8 +1,12 @@ import { connect } from 'react-redux'; -import { makeSelectClaimIsMine, makeSelectShortUrlForUri, makeSelectPermanentUrlForUri } from 'lbry-redux'; -import { selectChannelIsBlocked } from 'redux/selectors/blocked'; +import { + selectChannelIsBlocked, + doToggleBlockChannel, + makeSelectClaimIsMine, + makeSelectShortUrlForUri, + makeSelectPermanentUrlForUri, +} from 'lbry-redux'; import { doToast } from 'redux/actions/notifications'; -import { doToggleBlockChannel } from 'redux/actions/blocked'; import BlockButton from './view'; const select = (state, props) => ({ diff --git a/ui/component/channelContent/index.js b/ui/component/channelContent/index.js index e427523ec..68390df9e 100644 --- a/ui/component/channelContent/index.js +++ b/ui/component/channelContent/index.js @@ -6,9 +6,9 @@ import { makeSelectFetchingChannelClaims, makeSelectClaimIsMine, makeSelectTotalPagesInChannelSearch, + selectChannelIsBlocked, makeSelectClaimForUri, } from 'lbry-redux'; -import { selectChannelIsBlocked } from 'redux/selectors/blocked'; import { withRouter } from 'react-router'; import { selectUserVerifiedEmail } from 'redux/selectors/user'; import { makeSelectClientSetting } from 'redux/selectors/settings'; diff --git a/ui/component/claimListDiscover/index.js b/ui/component/claimListDiscover/index.js index 3f4f74c52..76e08edac 100644 --- a/ui/component/claimListDiscover/index.js +++ b/ui/component/claimListDiscover/index.js @@ -4,10 +4,10 @@ import { selectClaimSearchByQuery, selectClaimSearchByQueryLastPageReached, selectFetchingClaimSearch, + selectBlockedChannels, SETTINGS, selectFollowedTags, } from 'lbry-redux'; -import { selectBlockedChannels } from 'redux/selectors/blocked'; import { doToggleTagFollowDesktop } from 'redux/actions/tags'; import { makeSelectClientSetting } from 'redux/selectors/settings'; import ClaimListDiscover from './view'; diff --git a/ui/component/claimPreview/index.js b/ui/component/claimPreview/index.js index d80bd621f..20eeb0d2c 100644 --- a/ui/component/claimPreview/index.js +++ b/ui/component/claimPreview/index.js @@ -7,12 +7,13 @@ import { makeSelectClaimIsPending, makeSelectCoverForUri, makeSelectClaimIsNsfw, + selectBlockedChannels, + selectChannelIsBlocked, doFileGet, makeSelectReflectingClaimForUri, makeSelectClaimWasPurchased, makeSelectStreamingUrlForUri, } from 'lbry-redux'; -import { selectBlockedChannels, selectChannelIsBlocked } from 'redux/selectors/blocked'; import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc'; import { selectShowMatureContent } from 'redux/selectors/settings'; import { makeSelectHasVisitedUri } from 'redux/selectors/content'; diff --git a/ui/component/claimPreviewTile/index.js b/ui/component/claimPreviewTile/index.js index 9e6da683c..997f5708c 100644 --- a/ui/component/claimPreviewTile/index.js +++ b/ui/component/claimPreviewTile/index.js @@ -7,9 +7,9 @@ import { makeSelectTitleForUri, doFileGet, makeSelectChannelForClaimUri, + selectBlockedChannels, makeSelectClaimIsNsfw, } from 'lbry-redux'; -import { selectBlockedChannels } from 'redux/selectors/blocked'; import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc'; import { selectShowMatureContent } from 'redux/selectors/settings'; import ClaimPreviewTile from './view'; @@ -32,4 +32,7 @@ const perform = dispatch => ({ getFile: uri => dispatch(doFileGet(uri, false)), }); -export default connect(select, perform)(ClaimPreviewTile); +export default connect( + select, + perform +)(ClaimPreviewTile); diff --git a/ui/component/claimTilesDiscover/index.js b/ui/component/claimTilesDiscover/index.js index a549c5010..bfd8b94b4 100644 --- a/ui/component/claimTilesDiscover/index.js +++ b/ui/component/claimTilesDiscover/index.js @@ -1,6 +1,11 @@ import { connect } from 'react-redux'; -import { doClaimSearch, selectClaimSearchByQuery, selectFetchingClaimSearch, SETTINGS } from 'lbry-redux'; -import { selectBlockedChannels } from 'redux/selectors/blocked'; +import { + doClaimSearch, + selectClaimSearchByQuery, + selectFetchingClaimSearch, + selectBlockedChannels, + SETTINGS, +} from 'lbry-redux'; import { doToggleTagFollowDesktop } from 'redux/actions/tags'; import { makeSelectClientSetting } from 'redux/selectors/settings'; import ClaimListDiscover from './view'; diff --git a/ui/component/comment/index.js b/ui/component/comment/index.js index c285cabfe..5fccbab35 100644 --- a/ui/component/comment/index.js +++ b/ui/component/comment/index.js @@ -5,10 +5,10 @@ import { makeSelectClaimForUri, makeSelectThumbnailForUri, makeSelectIsUriResolving, + selectChannelIsBlocked, doCommentUpdate, // doEditComment would be a more fitting name doCommentAbandon, } from 'lbry-redux'; -import { selectChannelIsBlocked } from 'redux/selectors/blocked'; import Comment from './view'; const select = (state, props) => ({ diff --git a/ui/constants/action_types.js b/ui/constants/action_types.js index 2146bff33..1588104b8 100644 --- a/ui/constants/action_types.js +++ b/ui/constants/action_types.js @@ -246,6 +246,3 @@ export const COMMENT_UPDATE_FAILED = 'COMMENT_UPDATE_FAILED'; export const COMMENT_HIDE_STARTED = 'COMMENT_HIDE_STARTED'; export const COMMENT_HIDE_COMPLETED = 'COMMENT_HIDE_COMPLETED'; export const COMMENT_HIDE_FAILED = 'COMMENT_HIDE_FAILED'; - -// Blocked Channels -export const TOGGLE_BLOCK_CHANNEL = 'TOGGLE_BLOCK_CHANNEL'; diff --git a/ui/modal/modalRemoveBlocked/index.js b/ui/modal/modalRemoveBlocked/index.js index fcfb4404c..df24deff8 100644 --- a/ui/modal/modalRemoveBlocked/index.js +++ b/ui/modal/modalRemoveBlocked/index.js @@ -1,8 +1,7 @@ import { connect } from 'react-redux'; import { doHideModal } from 'redux/actions/app'; -import { doToggleBlockChannel } from 'redux/actions/blocked'; -import { selectBlockedChannels } from 'redux/selectors/blocked'; import ModalRemoveBlocked from './view'; +import { doToggleBlockChannel, selectBlockedChannels } from 'lbry-redux'; const select = (state, props) => ({ blockedChannels: selectBlockedChannels(state), diff --git a/ui/page/channel/index.js b/ui/page/channel/index.js index 50e07a8d8..184a51649 100644 --- a/ui/page/channel/index.js +++ b/ui/page/channel/index.js @@ -6,9 +6,9 @@ import { makeSelectCoverForUri, selectCurrentChannelPage, makeSelectClaimForUri, + selectChannelIsBlocked, makeSelectClaimIsPending, } from 'lbry-redux'; -import { selectChannelIsBlocked } from 'redux/selectors/blocked'; import { selectBlackListedOutpoints, doFetchSubCount, makeSelectSubCountForUri } from 'lbryinc'; import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions'; import { doOpenModal } from 'redux/actions/app'; diff --git a/ui/page/channelsFollowingDiscover/index.js b/ui/page/channelsFollowingDiscover/index.js index 89eb4c60f..dbfda416a 100644 --- a/ui/page/channelsFollowingDiscover/index.js +++ b/ui/page/channelsFollowingDiscover/index.js @@ -1,6 +1,5 @@ import { connect } from 'react-redux'; -import { selectFollowedTags } from 'lbry-redux'; -import { selectBlockedChannels } from 'redux/selectors/blocked'; +import { selectFollowedTags, selectBlockedChannels } from 'lbry-redux'; import { selectSubscriptions } from 'redux/selectors/subscriptions'; import ChannelsFollowingManagePage from './view'; diff --git a/ui/page/listBlocked/index.js b/ui/page/listBlocked/index.js index 80ecb2e97..c8088e9a5 100644 --- a/ui/page/listBlocked/index.js +++ b/ui/page/listBlocked/index.js @@ -1,9 +1,12 @@ import { connect } from 'react-redux'; -import { selectBlockedChannels } from 'redux/selectors/blocked'; +import { selectBlockedChannels } from 'lbry-redux'; import ListBlocked from './view'; const select = state => ({ uris: selectBlockedChannels(state), }); -export default connect(select, null)(ListBlocked); +export default connect( + select, + null +)(ListBlocked); diff --git a/ui/page/listBlocked/view.jsx b/ui/page/listBlocked/view.jsx index 9be6d3015..44cdfd885 100644 --- a/ui/page/listBlocked/view.jsx +++ b/ui/page/listBlocked/view.jsx @@ -2,7 +2,6 @@ import React from 'react'; import ClaimList from 'component/claimList'; import Page from 'component/page'; -import Card from 'component/common/card'; type Props = { uris: Array, @@ -14,10 +13,13 @@ function ListBlocked(props: Props) { return ( {uris && uris.length ? ( - } + {__('Your Blocked Channels')}} + persistedStorageKey="block-list-published" + uris={uris} + defaultSort + showUnresolvedClaims + showHiddenByUser /> ) : (
diff --git a/ui/page/settings/index.js b/ui/page/settings/index.js index 05cd5b0d3..6cbfac8af 100644 --- a/ui/page/settings/index.js +++ b/ui/page/settings/index.js @@ -22,8 +22,7 @@ import { selectFfmpegStatus, selectFindingFFmpeg, } from 'redux/selectors/settings'; -import { doWalletStatus, selectWalletIsEncrypted, SETTINGS } from 'lbry-redux'; -import { selectBlockedChannelsCount } from 'redux/selectors/blocked'; +import { doWalletStatus, selectWalletIsEncrypted, selectBlockedChannelsCount, SETTINGS } from 'lbry-redux'; import SettingsPage from './view'; import { selectUserVerifiedEmail } from 'redux/selectors/user'; diff --git a/ui/reducers.js b/ui/reducers.js index 7ee89c66b..1f255c96e 100644 --- a/ui/reducers.js +++ b/ui/reducers.js @@ -1,6 +1,14 @@ import { combineReducers } from 'redux'; import { connectRouter } from 'connected-react-router'; -import { claimsReducer, fileInfoReducer, searchReducer, walletReducer, tagsReducer, publishReducer } from 'lbry-redux'; +import { + claimsReducer, + fileInfoReducer, + searchReducer, + walletReducer, + tagsReducer, + blockedReducer, + publishReducer, +} from 'lbry-redux'; import { costInfoReducer, blacklistReducer, @@ -18,7 +26,6 @@ import notificationsReducer from 'redux/reducers/notifications'; import rewardsReducer from 'redux/reducers/rewards'; import userReducer from 'redux/reducers/user'; import commentsReducer from 'redux/reducers/comments'; -import blockedReducer from 'redux/reducers/blocked'; export default history => combineReducers({ diff --git a/ui/redux/actions/blocked.js b/ui/redux/actions/blocked.js deleted file mode 100644 index 1e9656307..000000000 --- a/ui/redux/actions/blocked.js +++ /dev/null @@ -1,9 +0,0 @@ -// @flow -import * as ACTIONS from 'constants/action_types'; - -export const doToggleBlockChannel = (uri: string) => ({ - type: ACTIONS.TOGGLE_BLOCK_CHANNEL, - data: { - uri, - }, -}); diff --git a/ui/redux/reducers/blocked.js b/ui/redux/reducers/blocked.js deleted file mode 100644 index b32285a9a..000000000 --- a/ui/redux/reducers/blocked.js +++ /dev/null @@ -1,39 +0,0 @@ -// @flow -import * as ACTIONS from 'constants/action_types'; -import { ACTIONS as LBRY_REDUX_ACTIONS } from 'lbry-redux'; -import { handleActions } from 'util/redux-utils'; - -const defaultState: BlocklistState = { - blockedChannels: [], -}; - -export default handleActions( - { - [ACTIONS.TOGGLE_BLOCK_CHANNEL]: (state: BlocklistState, action: BlocklistAction): BlocklistState => { - const { blockedChannels } = state; - const { uri } = action.data; - let newBlockedChannels = blockedChannels.slice(); - - if (newBlockedChannels.includes(uri)) { - newBlockedChannels = newBlockedChannels.filter(id => id !== uri); - } else { - newBlockedChannels.push(uri); - } - - return { - blockedChannels: newBlockedChannels, - }; - }, - [LBRY_REDUX_ACTIONS.USER_STATE_POPULATE]: ( - state: BlocklistState, - action: { data: { blocked: ?Array } } - ) => { - const { blocked } = action.data; - return { - ...state, - blockedChannels: blocked && blocked.length ? blocked : state.blockedChannels, - }; - }, - }, - defaultState -); diff --git a/ui/redux/selectors/blocked.js b/ui/redux/selectors/blocked.js deleted file mode 100644 index bd45c7f0c..000000000 --- a/ui/redux/selectors/blocked.js +++ /dev/null @@ -1,13 +0,0 @@ -// @flow -import { createSelector } from 'reselect'; - -const selectState = (state: { blocked: BlocklistState }) => state.blocked || {}; - -export const selectBlockedChannels = createSelector(selectState, (state: BlocklistState) => state.blockedChannels); - -export const selectBlockedChannelsCount = createSelector(selectBlockedChannels, (state: Array) => state.length); - -export const selectChannelIsBlocked = (uri: string) => - createSelector(selectBlockedChannels, (state: Array) => { - return state.includes(uri); - }); diff --git a/yarn.lock b/yarn.lock index b094f9470..ec86d69af 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6383,9 +6383,9 @@ lazy-val@^1.0.4: yargs "^13.2.2" zstd-codec "^0.1.1" -lbry-redux@lbryio/lbry-redux#0ec72d09d438c60d25cc56d256df971a9d3b2c0a: +lbry-redux@lbryio/lbry-redux#a1673ebfa933c0e921a23a1877d22e21c2bff8f9: version "0.0.1" - resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/0ec72d09d438c60d25cc56d256df971a9d3b2c0a" + resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/a1673ebfa933c0e921a23a1877d22e21c2bff8f9" dependencies: proxy-polyfill "0.1.6" reselect "^3.0.0"