fix unfollowing unpublished channels (#7737)
This commit is contained in:
parent
f1b1523017
commit
8dd7150d67
1 changed files with 9 additions and 3 deletions
|
@ -9,7 +9,7 @@ import {
|
|||
selectClaimForUri,
|
||||
} from 'redux/selectors/claims';
|
||||
import { swapKeyAndValue } from 'util/swap-json';
|
||||
import { getChannelFromClaim } from 'util/claim';
|
||||
import { getChannelFromClaim, isChannelClaim } from 'util/claim';
|
||||
|
||||
// Returns the entire subscriptions state
|
||||
const selectState = (state) => state.subscriptions || {};
|
||||
|
@ -114,12 +114,18 @@ export const makeSelectChannelInSubscriptions = (uri) =>
|
|||
createSelector(selectSubscriptions, (subscriptions) => subscriptions.some((sub) => sub.uri === uri));
|
||||
|
||||
export const selectIsSubscribedForUri = createCachedSelector(
|
||||
(state, uri) => uri,
|
||||
selectClaimForUri,
|
||||
selectSubscriptions,
|
||||
(claim, subscriptions) => {
|
||||
(uri, claim, subscriptions) => {
|
||||
const channelClaim = getChannelFromClaim(claim);
|
||||
if (channelClaim) {
|
||||
const uri = channelClaim.permanent_url;
|
||||
const permanentUrl = channelClaim.permanent_url;
|
||||
return subscriptions.some((sub) => isURIEqual(sub.uri, permanentUrl));
|
||||
}
|
||||
|
||||
// If it failed, it could be an abandoned channel. Try parseURI:
|
||||
if (isChannelClaim(claim, uri)) {
|
||||
return subscriptions.some((sub) => isURIEqual(sub.uri, uri));
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue