mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-01 01:35:11 +00:00
hide comments from blocked channels
This commit is contained in:
parent
81ffd7ae79
commit
9cfec1ce74
1 changed files with 11 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import { createSelector } from 'reselect';
|
import { createSelector } from 'reselect';
|
||||||
|
import { selectBlockedChannels } from 'redux/selectors/blocked';
|
||||||
|
|
||||||
const selectState = state => state.comments || {};
|
const selectState = state => state.comments || {};
|
||||||
|
|
||||||
|
@ -45,10 +46,16 @@ export const selectCommentsByUri = createSelector(selectState, state => {
|
||||||
});
|
});
|
||||||
|
|
||||||
export const makeSelectCommentsForUri = (uri: string) =>
|
export const makeSelectCommentsForUri = (uri: string) =>
|
||||||
createSelector(selectCommentsByClaimId, selectCommentsByUri, (byClaimId, byUri) => {
|
createSelector(
|
||||||
const claimId = byUri[uri];
|
selectCommentsByClaimId,
|
||||||
return byClaimId && byClaimId[claimId];
|
selectCommentsByUri,
|
||||||
});
|
selectBlockedChannels,
|
||||||
|
(byClaimId, byUri, blockedChannels) => {
|
||||||
|
const claimId = byUri[uri];
|
||||||
|
const comments = byClaimId && byClaimId[claimId];
|
||||||
|
return comments ? comments.filter(comment => !blockedChannels.includes(comment.channel_url)) : [];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// todo: allow SDK to retrieve user comments through comment_list
|
// todo: allow SDK to retrieve user comments through comment_list
|
||||||
// todo: implement selectors for selecting comments owned by user
|
// todo: implement selectors for selecting comments owned by user
|
||||||
|
|
Loading…
Add table
Reference in a new issue