Compare commits

...

2 commits

Author SHA1 Message Date
Sean Yesmunt
02fb30199f create makeSelectClaimHasSource 2021-03-17 14:39:18 -04:00
Sean Yesmunt
d10ed9ff72 add has_source and has_no_source to doClaimSearch options 2021-03-17 13:40:03 -04:00
5 changed files with 29 additions and 57 deletions

38
dist/bundle.es.js vendored
View file

@ -2674,6 +2674,14 @@ const makeSelectTagInClaimOrChannelForUri = (uri, tag) => reselect.createSelecto
return claimTags.includes(tag) || channelTags.includes(tag); 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 => { const makeSelectTotalStakedAmountForChannelUri = uri => reselect.createSelector(makeSelectClaimForUri(uri), claim => {
if (!claim || !claim.amount || !claim.meta || !claim.meta.support_amount) { if (!claim || !claim.amount || !claim.meta || !claim.meta.support_amount) {
return 0; return 0;
@ -4832,34 +4840,7 @@ const doPublish = (success, fail, preview) => (dispatch, getState) => {
// Only pass file on new uploads, not metadata only edits. // Only pass file on new uploads, not metadata only edits.
// The sdk will figure it out // The sdk will figure it out
if (filePath) publishPayload.file_path = filePath; if (filePath && !isLivestreamPublish) 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 (preview) { if (preview) {
publishPayload.preview = true; publishPayload.preview = true;
@ -6617,6 +6598,7 @@ exports.makeSelectChannelForClaimUri = makeSelectChannelForClaimUri;
exports.makeSelectChannelPermUrlForClaimUri = makeSelectChannelPermUrlForClaimUri; exports.makeSelectChannelPermUrlForClaimUri = makeSelectChannelPermUrlForClaimUri;
exports.makeSelectClaimForClaimId = makeSelectClaimForClaimId; exports.makeSelectClaimForClaimId = makeSelectClaimForClaimId;
exports.makeSelectClaimForUri = makeSelectClaimForUri; exports.makeSelectClaimForUri = makeSelectClaimForUri;
exports.makeSelectClaimHasSource = makeSelectClaimHasSource;
exports.makeSelectClaimIsMine = makeSelectClaimIsMine; exports.makeSelectClaimIsMine = makeSelectClaimIsMine;
exports.makeSelectClaimIsNsfw = makeSelectClaimIsNsfw; exports.makeSelectClaimIsNsfw = makeSelectClaimIsNsfw;
exports.makeSelectClaimIsPending = makeSelectClaimIsPending; exports.makeSelectClaimIsPending = makeSelectClaimIsPending;

View file

@ -188,6 +188,7 @@ export {
makeSelectClaimWasPurchased, makeSelectClaimWasPurchased,
makeSelectAbandoningClaimById, makeSelectAbandoningClaimById,
makeSelectIsAbandoningClaimForUri, makeSelectIsAbandoningClaimForUri,
makeSelectClaimHasSource,
selectPendingIds, selectPendingIds,
selectReflectingById, selectReflectingById,
makeSelectClaimForClaimId, makeSelectClaimForClaimId,

View file

@ -585,6 +585,8 @@ export function doClaimSearch(
not_tags?: Array<string>, not_tags?: Array<string>,
order_by?: Array<string>, order_by?: Array<string>,
release_time?: string, release_time?: string,
has_source?: boolean,
has_no_souce?: boolean,
} = { } = {
no_totals: true, no_totals: true,
page_size: 10, page_size: 10,

View file

@ -371,34 +371,7 @@ export const doPublish = (success: Function, fail: Function, preview: Function)
// Only pass file on new uploads, not metadata only edits. // Only pass file on new uploads, not metadata only edits.
// The sdk will figure it out // The sdk will figure it out
if (filePath) publishPayload.file_path = filePath; if (filePath && !isLivestreamPublish) 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 (preview) { if (preview) {
publishPayload.preview = true; publishPayload.preview = true;

View file

@ -127,7 +127,9 @@ export const makeSelectClaimForUri = (uri: string, returnRepost: boolean = true)
const repostedClaim = claim && claim.reposted_claim; const repostedClaim = claim && claim.reposted_claim;
if (repostedClaim && returnRepost) { 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 { return {
...repostedClaim, ...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) => export const makeSelectTotalStakedAmountForChannelUri = (uri: string) =>
createSelector( createSelector(
makeSelectClaimForUri(uri), makeSelectClaimForUri(uri),