Channel filter mm #175
59
dist/bundle.es.js
vendored
|
@ -260,6 +260,8 @@ const FETCH_COST_INFO_FAILED = 'FETCH_COST_INFO_FAILED';
|
|||
const TOGGLE_TAG_FOLLOW = 'TOGGLE_TAG_FOLLOW';
|
||||
const TAG_ADD = 'TAG_ADD';
|
||||
const TAG_DELETE = 'TAG_DELETE';
|
||||
// Blocked Channels
|
||||
const TOGGLE_BLOCK_CHANNEL = 'TOGGLE_BLOCK_CHANNEL';
|
||||
|
||||
var action_types = /*#__PURE__*/Object.freeze({
|
||||
WINDOW_FOCUSED: WINDOW_FOCUSED,
|
||||
|
@ -466,7 +468,8 @@ var action_types = /*#__PURE__*/Object.freeze({
|
|||
FETCH_COST_INFO_FAILED: FETCH_COST_INFO_FAILED,
|
||||
TOGGLE_TAG_FOLLOW: TOGGLE_TAG_FOLLOW,
|
||||
TAG_ADD: TAG_ADD,
|
||||
TAG_DELETE: TAG_DELETE
|
||||
TAG_DELETE: TAG_DELETE,
|
||||
TOGGLE_BLOCK_CHANNEL: TOGGLE_BLOCK_CHANNEL
|
||||
});
|
||||
|
||||
const CC_LICENSES = [{
|
||||
|
@ -3432,6 +3435,15 @@ function doCommentCreate(comment = '', claim_id = '', channel, parent_id) {
|
|||
};
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
const doToggleBlockChannel = uri => ({
|
||||
type: TOGGLE_BLOCK_CHANNEL,
|
||||
data: {
|
||||
uri
|
||||
}
|
||||
});
|
||||
|
||||
var _extends$5 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
const reducers = {};
|
||||
|
@ -4353,6 +4365,30 @@ const tagsReducer = handleActions({
|
|||
}
|
||||
}, defaultState$8);
|
||||
|
||||
//
|
||||
|
||||
const defaultState$9 = {
|
||||
blockedChannels: []
|
||||
};
|
||||
|
||||
const blockedReducer = handleActions({
|
||||
[TOGGLE_BLOCK_CHANNEL]: (state, action) => {
|
||||
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
|
||||
};
|
||||
}
|
||||
}, defaultState$9);
|
||||
|
||||
var _extends$e = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
const buildDraftTransaction = () => ({
|
||||
|
@ -4364,7 +4400,7 @@ const buildDraftTransaction = () => ({
|
|||
// See details in https://github.com/lbryio/lbry/issues/1307
|
||||
|
||||
|
||||
const defaultState$9 = {
|
||||
const defaultState$a = {
|
||||
balance: undefined,
|
||||
totalBalance: undefined,
|
||||
latestBlock: undefined,
|
||||
|
@ -4607,7 +4643,7 @@ const walletReducer = handleActions({
|
|||
[UPDATE_CURRENT_HEIGHT]: (state, action) => _extends$e({}, state, {
|
||||
latestBlock: action.data
|
||||
})
|
||||
}, defaultState$9);
|
||||
}, defaultState$a);
|
||||
|
||||
const selectState$6 = state => state.content || {};
|
||||
|
||||
|
@ -4695,6 +4731,18 @@ const selectUnfollowedTags = reselect.createSelector(selectKnownTagsByName, sele
|
|||
return tagsToReturn;
|
||||
});
|
||||
|
||||
//
|
||||
|
||||
const selectState$a = state => state.blocked || {};
|
||||
|
||||
const selectBlockedChannels = reselect.createSelector(selectState$a, state => state.blockedChannels);
|
||||
|
||||
const selectBlockedChannelsCount = reselect.createSelector(selectBlockedChannels, state => state.length);
|
||||
|
||||
const selectChannelIsBlocked = uri => reselect.createSelector(selectBlockedChannels, state => {
|
||||
return state.includes(uri);
|
||||
});
|
||||
|
||||
exports.ACTIONS = action_types;
|
||||
exports.CLAIM_VALUES = claim;
|
||||
exports.DEFAULT_FOLLOWED_TAGS = DEFAULT_FOLLOWED_TAGS;
|
||||
|
@ -4710,6 +4758,7 @@ exports.SORT_OPTIONS = sort_options;
|
|||
exports.THUMBNAIL_STATUSES = thumbnail_upload_statuses;
|
||||
exports.TRANSACTIONS = transaction_types;
|
||||
exports.batchActions = batchActions;
|
||||
exports.blockedReducer = blockedReducer;
|
||||
exports.buildURI = buildURI;
|
||||
exports.claimsReducer = claimsReducer;
|
||||
exports.commentReducer = commentReducer;
|
||||
|
@ -4757,6 +4806,7 @@ exports.doSetDraftTransactionAmount = doSetDraftTransactionAmount;
|
|||
exports.doSetFileListSort = doSetFileListSort;
|
||||
exports.doSetTransactionListFilter = doSetTransactionListFilter;
|
||||
exports.doToast = doToast;
|
||||
exports.doToggleBlockChannel = doToggleBlockChannel;
|
||||
exports.doToggleTagFollow = doToggleTagFollow;
|
||||
exports.doTotalBalanceSubscribe = doTotalBalanceSubscribe;
|
||||
exports.doUpdateBalance = doUpdateBalance;
|
||||
|
@ -4828,8 +4878,11 @@ exports.selectAllClaimsByChannel = selectAllClaimsByChannel;
|
|||
exports.selectAllFetchingChannelClaims = selectAllFetchingChannelClaims;
|
||||
exports.selectAllMyClaimsByOutpoint = selectAllMyClaimsByOutpoint;
|
||||
exports.selectBalance = selectBalance;
|
||||
exports.selectBlockedChannels = selectBlockedChannels;
|
||||
exports.selectBlockedChannelsCount = selectBlockedChannelsCount;
|
||||
exports.selectBlocks = selectBlocks;
|
||||
exports.selectChannelClaimCounts = selectChannelClaimCounts;
|
||||
exports.selectChannelIsBlocked = selectChannelIsBlocked;
|
||||
exports.selectClaimSearchByQuery = selectClaimSearchByQuery;
|
||||
exports.selectClaimsById = selectClaimsById;
|
||||
exports.selectClaimsByUri = selectClaimsByUri;
|
||||
|
|
10
dist/flow-typed/Blocklist.js
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
declare type BlocklistState = {
|
||||
blockedChannels: Array<string>
|
||||
};
|
||||
|
||||
declare type BlocklistAction = {
|
||||
type: string,
|
||||
data: {
|
||||
uri: string,
|
||||
},
|
||||
};
|
10
flow-typed/Blocklist.js
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
declare type BlocklistState = {
|
||||
blockedChannels: Array<string>
|
||||
};
|
||||
|
||||
declare type BlocklistAction = {
|
||||
type: string,
|
||||
data: {
|
||||
uri: string,
|
||||
},
|
||||
};
|
|
@ -235,3 +235,5 @@ export const FETCH_COST_INFO_FAILED = 'FETCH_COST_INFO_FAILED';
|
|||
export const TOGGLE_TAG_FOLLOW = 'TOGGLE_TAG_FOLLOW';
|
||||
export const TAG_ADD = 'TAG_ADD';
|
||||
export const TAG_DELETE = 'TAG_DELETE';
|
||||
// Blocked Channels
|
||||
export const TOGGLE_BLOCK_CHANNEL = 'TOGGLE_BLOCK_CHANNEL';
|
||||
|
|
|
@ -111,6 +111,8 @@ export { doToggleTagFollow, doAddTag, doDeleteTag } from 'redux/actions/tags';
|
|||
|
||||
export { doCommentList, doCommentCreate } from 'redux/actions/comments';
|
||||
|
||||
export { doToggleBlockChannel } from 'redux/actions/blocked';
|
||||
|
||||
// utils
|
||||
export { batchActions } from 'util/batch-actions';
|
||||
export { parseQueryParams, toQueryString } from 'util/query-params';
|
||||
|
@ -127,6 +129,7 @@ export { notificationsReducer } from 'redux/reducers/notifications';
|
|||
export { publishReducer } from 'redux/reducers/publish';
|
||||
export { searchReducer } from 'redux/reducers/search';
|
||||
export { tagsReducer } from 'redux/reducers/tags';
|
||||
export { blockedReducer } from 'redux/reducers/blocked';
|
||||
export { walletReducer } from 'redux/reducers/wallet';
|
||||
|
||||
// selectors
|
||||
|
@ -269,3 +272,9 @@ export {
|
|||
} from 'redux/selectors/wallet';
|
||||
|
||||
export { selectFollowedTags, selectUnfollowedTags } from 'redux/selectors/tags';
|
||||
|
||||
export {
|
||||
selectBlockedChannels,
|
||||
selectChannelIsBlocked,
|
||||
selectBlockedChannelsCount,
|
||||
} from 'redux/selectors/blocked';
|
||||
|
|
9
src/redux/actions/blocked.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
// @flow
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
|
||||
export const doToggleBlockChannel = (uri: string) => ({
|
||||
type: ACTIONS.TOGGLE_BLOCK_CHANNEL,
|
||||
data: {
|
||||
uri,
|
||||
},
|
||||
});
|
31
src/redux/reducers/blocked.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
// @flow
|
||||
import * as ACTIONS from 'constants/action_types';
|
||||
import { handleActions } from 'util/redux-utils';
|
||||
|
||||
const defaultState: BlocklistState = {
|
||||
blockedChannels: [],
|
||||
};
|
||||
|
||||
export const blockedReducer = 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,
|
||||
};
|
||||
},
|
||||
},
|
||||
defaultState
|
||||
);
|
22
src/redux/selectors/blocked.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
// @flow
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
import { createSelector } from 'reselect';
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
const selectState = (state: { blocked: BlocklistState }) => state.blocked || {};
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
export const selectBlockedChannels = createSelector(
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
selectState,
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
(state: BlocklistState) => state.blockedChannels
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
);
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
export const selectBlockedChannelsCount = createSelector(
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
selectBlockedChannels,
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
(state: Array<string>) => state.length
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
);
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
export const selectChannelIsBlocked = (uri: string) =>
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
createSelector(
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
selectBlockedChannels,
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
(state: Array<string>) => {
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
return state.includes(uri);
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
}
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
||||
);
|
||||
![]() Not a big deal but this should probably use Not a big deal but this should probably use `selectBlockedChannels` instead of `selectState`
|
|
@ -190,31 +190,31 @@ export const selectSearchDownloadUris = query =>
|
|||
|
||||
return downloadResultsFromQuery.length
|
||||
? downloadResultsFromQuery.map(fileInfo => {
|
||||
const {
|
||||
channel_name: channelName,
|
||||
claim_id: claimId,
|
||||
claim_name: claimName,
|
||||
} = fileInfo;
|
||||
const {
|
||||
channel_name: channelName,
|
||||
claim_id: claimId,
|
||||
claim_name: claimName,
|
||||
} = fileInfo;
|
||||
|
||||
const uriParams = {};
|
||||
const uriParams = {};
|
||||
|
||||
if (channelName) {
|
||||
const claim = claimsById[claimId];
|
||||
if (claim && claim.signing_channel) {
|
||||
uriParams.claimId = claim.signing_channel.claim_id;
|
||||
} else {
|
||||
uriParams.claimId = claimId;
|
||||
}
|
||||
uriParams.channelName = channelName;
|
||||
uriParams.contentName = claimName;
|
||||
if (channelName) {
|
||||
const claim = claimsById[claimId];
|
||||
if (claim && claim.signing_channel) {
|
||||
uriParams.claimId = claim.signing_channel.claim_id;
|
||||
} else {
|
||||
uriParams.claimId = claimId;
|
||||
uriParams.claimName = claimName;
|
||||
}
|
||||
uriParams.channelName = channelName;
|
||||
uriParams.contentName = claimName;
|
||||
} else {
|
||||
uriParams.claimId = claimId;
|
||||
uriParams.claimName = claimName;
|
||||
}
|
||||
|
||||
const uri = buildURI(uriParams);
|
||||
return uri;
|
||||
})
|
||||
const uri = buildURI(uriParams);
|
||||
return uri;
|
||||
})
|
||||
: null;
|
||||
}
|
||||
);
|
||||
|
|
Not a big deal but this should probably use
selectBlockedChannels
instead ofselectState