better handle reposts

This commit is contained in:
saltrafael 2021-06-14 08:44:51 -03:00 committed by jessopb
parent 6629ea6041
commit 32d2ac2fc9
3 changed files with 13 additions and 11 deletions

View file

@ -79,7 +79,7 @@ const ClaimCollectionAdd = (props: Props) => {
.filter((list) => (isChannel ? list.type === 'collection' : list.type === 'playlist'))
.map((l) => {
const { id } = l;
return <CollectionSelectItem collectionId={id} uri={permanentUrl} key={id} category={'builtin'} />;
return <CollectionSelectItem claim={claim} collectionId={id} uri={permanentUrl} key={id} category={'builtin'} />;
})}
{unpublished &&
(Object.values(unpublished): any)
@ -88,7 +88,7 @@ const ClaimCollectionAdd = (props: Props) => {
.map((l) => {
const { id } = l;
return (
<CollectionSelectItem collectionId={id} uri={permanentUrl} key={id} category={'unpublished'} />
<CollectionSelectItem claim={claim} collectionId={id} uri={permanentUrl} key={id} category={'unpublished'} />
);
})}
{published &&
@ -96,7 +96,7 @@ const ClaimCollectionAdd = (props: Props) => {
// $FlowFixMe
const { id } = l;
return (
<CollectionSelectItem collectionId={id} uri={permanentUrl} key={id} category={'published'} />
<CollectionSelectItem claim={claim} collectionId={id} uri={permanentUrl} key={id} category={'published'} />
);
})}
</div>

View file

@ -80,6 +80,8 @@ function ClaimMenuList(props: Props) {
doChannelUnsubscribe,
isChannelPage = false,
} = props;
const repostedContent = claim && claim.reposted_claim;
const contentClaim = repostedContent || claim;
const incognito = channelUri && !(channelUri.includes('@'));
const signingChannel = claim && (claim.signing_channel || claim);
const permanentUrl = String(channelUri);
@ -96,12 +98,13 @@ function ClaimMenuList(props: Props) {
const isCollectionClaim = claim && claim.value_type === 'collection';
// $FlowFixMe
const isPlayable =
claim &&
!claim.repost_url &&
contentClaim &&
// $FlowFixMe
claim.value.stream_type &&
contentClaim.value &&
// $FlowFixMe
(claim.value.stream_type === 'audio' || claim.value.stream_type === 'video');
contentClaim.value.stream_type &&
// $FlowFixMe
(contentClaim.value.stream_type === 'audio' || contentClaim.value.stream_type === 'video');
function handleFollow() {
const { channelName } = parseURI(permanentUrl);
@ -172,7 +175,8 @@ function ClaimMenuList(props: Props) {
}
function handleReportContent() {
push(`/$/${PAGES.REPORT_CONTENT}?claimId=${claim.claim_id}`);
// $FlowFixMe
push(`/$/${PAGES.REPORT_CONTENT}?claimId=${(repostedContent && repostedContent.claim_id) || claim.claim_id}`);
}
return (
@ -218,7 +222,7 @@ function ClaimMenuList(props: Props) {
}),
});
doCollectionEdit(COLLECTIONS_CONSTS.WATCH_LATER_ID, {
claims: [claim],
claims: [contentClaim],
remove: hasClaimInWatchLater,
type: 'playlist',
});

View file

@ -1,7 +1,6 @@
import { connect } from 'react-redux';
import {
doCollectionEdit,
makeSelectClaimForUri,
makeSelectCollectionForId,
makeSelectClaimIsPending,
makeSelectCollectionForIdHasClaimUrl,
@ -12,7 +11,6 @@ const select = (state, props) => {
return {
collection: makeSelectCollectionForId(props.collectionId)(state),
hasClaim: makeSelectCollectionForIdHasClaimUrl(props.collectionId, props.uri)(state),
claim: makeSelectClaimForUri(props.uri)(state),
collectionPending: makeSelectClaimIsPending(props.collectionId)(state),
};
};