Merge pull request #275 from lbryio/repost-fixes

add repost_url and also add a way to return the original claim instead of the reposted claim
This commit is contained in:
Sean Yesmunt 2020-02-12 09:45:12 -05:00 committed by GitHub
commit ad58b8c6b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

5
dist/bundle.es.js vendored
View file

@ -2010,7 +2010,7 @@ const makeSelectPendingByUri = uri => reselect.createSelector(selectPendingById,
return pendingById[claimId]; return pendingById[claimId];
}); });
const makeSelectClaimForUri = uri => reselect.createSelector(selectClaimsByUri, selectPendingById, (byUri, pendingById) => { const makeSelectClaimForUri = (uri, returnRepost = true) => reselect.createSelector(selectClaimsByUri, selectPendingById, (byUri, pendingById) => {
// Check if a claim is pending first // Check if a claim is pending first
// It won't be in claimsByUri because resolving it will return nothing // It won't be in claimsByUri because resolving it will return nothing
@ -2038,10 +2038,11 @@ const makeSelectClaimForUri = uri => reselect.createSelector(selectClaimsByUri,
} }
const repostedClaim = claim.reposted_claim; const repostedClaim = claim.reposted_claim;
if (repostedClaim) { if (repostedClaim && returnRepost) {
const channelUrl = claim.signing_channel && claim.signing_channel.canonical_url; const channelUrl = claim.signing_channel && claim.signing_channel.canonical_url;
return _extends$4({}, repostedClaim, { return _extends$4({}, repostedClaim, {
repost_url: uri,
repost_channel_url: channelUrl repost_channel_url: channelUrl
}); });
} else { } else {

View file

@ -107,7 +107,7 @@ export const makeSelectPendingByUri = (uri: string) =>
} }
); );
export const makeSelectClaimForUri = (uri: string) => export const makeSelectClaimForUri = (uri: string, returnRepost: boolean = true) =>
createSelector( createSelector(
selectClaimsByUri, selectClaimsByUri,
selectPendingById, selectPendingById,
@ -139,11 +139,12 @@ export const makeSelectClaimForUri = (uri: string) =>
} }
const repostedClaim = claim.reposted_claim; const repostedClaim = claim.reposted_claim;
if (repostedClaim) { if (repostedClaim && returnRepost) {
const channelUrl = claim.signing_channel && claim.signing_channel.canonical_url; const channelUrl = claim.signing_channel && claim.signing_channel.canonical_url;
return { return {
...repostedClaim, ...repostedClaim,
repost_url: uri,
repost_channel_url: channelUrl, repost_channel_url: channelUrl,
}; };
} else { } else {