diff --git a/ui/redux/selectors/claims.js b/ui/redux/selectors/claims.js index 83daeddaa..b4cc75b52 100644 --- a/ui/redux/selectors/claims.js +++ b/ui/redux/selectors/claims.js @@ -143,6 +143,9 @@ export const makeSelectClaimForUri = (uri: string, returnRepost: boolean = true) } }); +// Returns your claim IDs without handling pending and abandoned claims. +export const selectMyClaimIdsRaw = (state: State) => selectState(state).myClaims; + export const selectMyClaimsRaw = createSelector(selectState, selectClaimsById, (state, byId) => { const ids = state.myClaims; if (!ids) { diff --git a/ui/redux/selectors/comments.js b/ui/redux/selectors/comments.js index 82b04a4a9..5b3b58963 100644 --- a/ui/redux/selectors/comments.js +++ b/ui/redux/selectors/comments.js @@ -4,7 +4,7 @@ import { createCachedSelector } from 're-reselect'; import { selectMutedChannels } from 'redux/selectors/blocked'; import { selectShowMatureContent } from 'redux/selectors/settings'; import { selectBlacklistedOutpointMap, selectFilteredOutpointMap } from 'lbryinc'; -import { selectClaimsById, selectMyActiveClaims } from 'redux/selectors/claims'; +import { selectClaimsById, selectMyClaimIdsRaw } from 'redux/selectors/claims'; import { isClaimNsfw } from 'util/claim'; type State = { comments: CommentsState }; @@ -180,7 +180,7 @@ export const makeSelectCommentIdsForUri = (uri: string) => const filterCommentsDepOnList = { claimsById: selectClaimsById, - myClaims: selectMyActiveClaims, + myClaimIds: selectMyClaimIdsRaw, mutedChannels: selectMutedChannels, personalBlockList: selectModerationBlockList, blacklistedMap: selectBlacklistedOutpointMap, @@ -258,7 +258,7 @@ export const selectRepliesForParentId = createCachedSelector( * * @param comments List of comments to filter. * @param claimId The claim that `comments` reside in. - * @oaram filterInputs Values returned by filterCommentsDepOnList. + * @param filterInputs Values returned by filterCommentsDepOnList. */ const filterComments = (comments: Array, claimId?: string, filterInputs: any) => { const filterProps = filterInputs.reduce(function (acc, cur, i) { @@ -268,7 +268,7 @@ const filterComments = (comments: Array, claimId?: string, filterInputs const { claimsById, - myClaims, + myClaimIds, mutedChannels, personalBlockList, blacklistedMap, @@ -287,8 +287,8 @@ const filterComments = (comments: Array, claimId?: string, filterInputs // Return comment if `channelClaim` doesn't exist so the component knows to resolve the author if (channelClaim) { - if (myClaims && myClaims.size > 0) { - const claimIsMine = channelClaim.is_my_output || myClaims.has(channelClaim.claim_id); + if (myClaimIds && myClaimIds.size > 0) { + const claimIsMine = channelClaim.is_my_output || myClaimIds.includes(channelClaim.claim_id); if (claimIsMine) { return true; } @@ -308,7 +308,7 @@ const filterComments = (comments: Array, claimId?: string, filterInputs } if (claimId) { - const claimIdIsMine = myClaims && myClaims.size > 0 && myClaims.has(claimId); + const claimIdIsMine = myClaimIds && myClaimIds.size > 0 && myClaimIds.includes(claimId); if (!claimIdIsMine) { if (personalBlockList.includes(comment.channel_url)) { return false;