From d10ed9ff729c30ddffea2e53029e6d1da4ec2c07 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 17 Mar 2021 13:40:03 -0400 Subject: [PATCH 1/2] add has_source and has_no_source to doClaimSearch options --- src/redux/actions/claims.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/redux/actions/claims.js b/src/redux/actions/claims.js index 7c42f54..a50c4f6 100644 --- a/src/redux/actions/claims.js +++ b/src/redux/actions/claims.js @@ -585,6 +585,8 @@ export function doClaimSearch( not_tags?: Array, order_by?: Array, release_time?: string, + has_source?: boolean, + has_no_souce?: boolean, } = { no_totals: true, page_size: 10, -- 2.45.2 From 02fb30199ff39cf51f738446809a3aa3682e1658 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 17 Mar 2021 14:39:18 -0400 Subject: [PATCH 2/2] create makeSelectClaimHasSource --- dist/bundle.es.js | 38 +++++++++-------------------------- src/index.js | 1 + src/redux/actions/publish.js | 29 +------------------------- src/redux/selectors/claims.js | 16 ++++++++++++++- 4 files changed, 27 insertions(+), 57 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 869276b..ebaba32 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -2674,6 +2674,14 @@ const makeSelectTagInClaimOrChannelForUri = (uri, tag) => reselect.createSelecto return claimTags.includes(tag) || channelTags.includes(tag); }); +const makeSelectClaimHasSource = uri => reselect.createSelector(makeSelectClaimForUri(uri), claim => { + if (!claim) { + return false; + } + + return Boolean(claim.value.source); +}); + const makeSelectTotalStakedAmountForChannelUri = uri => reselect.createSelector(makeSelectClaimForUri(uri), claim => { if (!claim || !claim.amount || !claim.meta || !claim.meta.support_amount) { return 0; @@ -4832,34 +4840,7 @@ const doPublish = (success, fail, preview) => (dispatch, getState) => { // Only pass file on new uploads, not metadata only edits. // The sdk will figure it out - if (filePath) publishPayload.file_path = filePath; - - if (isLivestreamPublish) { - var d = new Date(); - - // Set it to one month in future so it's hidden in apps - d.setFullYear(d.getFullYear() - 10); - d.setHours(0, 0, 0); - d.setMilliseconds(0); - - const releaseTimeInSeconds = d / 1000; - - publishPayload.release_time = releaseTimeInSeconds; - - if (publishPayload.tags) { - if (!publishPayload.tags.includes('odysee-livestream')) { - publishPayload.tags.push('odysee-livestream'); - } - } else { - publishPayload.tags = ['odysee-livestream']; - } - } else if (publishPayload.tags && publishPayload.tags.includes('odysee-livestream')) { - let newReleaseTime = new Date(); - newReleaseTime.setMilliseconds(0); - publishPayload.release_time = newReleaseTime / 1000; - - publishPayload.tags = publishPayload.tags.filter(tag => tag !== 'odysee-livestream'); - } + if (filePath && !isLivestreamPublish) publishPayload.file_path = filePath; if (preview) { publishPayload.preview = true; @@ -6617,6 +6598,7 @@ exports.makeSelectChannelForClaimUri = makeSelectChannelForClaimUri; exports.makeSelectChannelPermUrlForClaimUri = makeSelectChannelPermUrlForClaimUri; exports.makeSelectClaimForClaimId = makeSelectClaimForClaimId; exports.makeSelectClaimForUri = makeSelectClaimForUri; +exports.makeSelectClaimHasSource = makeSelectClaimHasSource; exports.makeSelectClaimIsMine = makeSelectClaimIsMine; exports.makeSelectClaimIsNsfw = makeSelectClaimIsNsfw; exports.makeSelectClaimIsPending = makeSelectClaimIsPending; diff --git a/src/index.js b/src/index.js index 568abd7..8d9b0f4 100644 --- a/src/index.js +++ b/src/index.js @@ -188,6 +188,7 @@ export { makeSelectClaimWasPurchased, makeSelectAbandoningClaimById, makeSelectIsAbandoningClaimForUri, + makeSelectClaimHasSource, selectPendingIds, selectReflectingById, makeSelectClaimForClaimId, diff --git a/src/redux/actions/publish.js b/src/redux/actions/publish.js index ec8bc09..52cba30 100644 --- a/src/redux/actions/publish.js +++ b/src/redux/actions/publish.js @@ -371,34 +371,7 @@ export const doPublish = (success: Function, fail: Function, preview: Function) // Only pass file on new uploads, not metadata only edits. // The sdk will figure it out - if (filePath) publishPayload.file_path = filePath; - - if (isLivestreamPublish) { - var d = new Date(); - - // Set it to one month in future so it's hidden in apps - d.setFullYear(d.getFullYear() - 10); - d.setHours(0, 0, 0); - d.setMilliseconds(0); - - const releaseTimeInSeconds = d / 1000; - - publishPayload.release_time = releaseTimeInSeconds; - - if (publishPayload.tags) { - if (!publishPayload.tags.includes('odysee-livestream')) { - publishPayload.tags.push('odysee-livestream'); - } - } else { - publishPayload.tags = ['odysee-livestream']; - } - } else if (publishPayload.tags && publishPayload.tags.includes('odysee-livestream')) { - let newReleaseTime = new Date(); - newReleaseTime.setMilliseconds(0); - publishPayload.release_time = newReleaseTime / 1000; - - publishPayload.tags = publishPayload.tags.filter(tag => tag !== 'odysee-livestream'); - } + if (filePath && !isLivestreamPublish) publishPayload.file_path = filePath; if (preview) { publishPayload.preview = true; diff --git a/src/redux/selectors/claims.js b/src/redux/selectors/claims.js index 20362ac..1497bd4 100644 --- a/src/redux/selectors/claims.js +++ b/src/redux/selectors/claims.js @@ -127,7 +127,9 @@ export const makeSelectClaimForUri = (uri: string, returnRepost: boolean = true) const repostedClaim = claim && claim.reposted_claim; if (repostedClaim && returnRepost) { - const channelUrl = claim.signing_channel && (claim.signing_channel.canonical_url || claim.signing_channel.permanent_url); + const channelUrl = + claim.signing_channel && + (claim.signing_channel.canonical_url || claim.signing_channel.permanent_url); return { ...repostedClaim, @@ -851,6 +853,18 @@ export const makeSelectTagInClaimOrChannelForUri = (uri: string, tag: string) => } ); +export const makeSelectClaimHasSource = (uri: string) => + createSelector( + makeSelectClaimForUri(uri), + claim => { + if (!claim) { + return false; + } + + return Boolean(claim.value.source); + } + ); + export const makeSelectTotalStakedAmountForChannelUri = (uri: string) => createSelector( makeSelectClaimForUri(uri), -- 2.45.2