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:43:41 -05:00
parent 2f6d0b909d
commit e7c42df2ad
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];
});
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
// 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;
if (repostedClaim) {
if (repostedClaim && returnRepost) {
const channelUrl = claim.signing_channel && claim.signing_channel.canonical_url;
return _extends$4({}, repostedClaim, {
repost_url: uri,
repost_channel_url: channelUrl
});
} 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(
selectClaimsByUri,
selectPendingById,
@ -139,11 +139,12 @@ export const makeSelectClaimForUri = (uri: string) =>
}
const repostedClaim = claim.reposted_claim;
if (repostedClaim) {
if (repostedClaim && returnRepost) {
const channelUrl = claim.signing_channel && claim.signing_channel.canonical_url;
return {
...repostedClaim,
repost_url: uri,
repost_channel_url: channelUrl,
};
} else {