create makeSelectClaimHasSource
This commit is contained in:
parent
d10ed9ff72
commit
02fb30199f
4 changed files with 27 additions and 57 deletions
38
dist/bundle.es.js
vendored
38
dist/bundle.es.js
vendored
|
@ -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;
|
||||||
|
|
|
@ -188,6 +188,7 @@ export {
|
||||||
makeSelectClaimWasPurchased,
|
makeSelectClaimWasPurchased,
|
||||||
makeSelectAbandoningClaimById,
|
makeSelectAbandoningClaimById,
|
||||||
makeSelectIsAbandoningClaimForUri,
|
makeSelectIsAbandoningClaimForUri,
|
||||||
|
makeSelectClaimHasSource,
|
||||||
selectPendingIds,
|
selectPendingIds,
|
||||||
selectReflectingById,
|
selectReflectingById,
|
||||||
makeSelectClaimForClaimId,
|
makeSelectClaimForClaimId,
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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),
|
||||||
|
|
Loading…
Reference in a new issue