check for confirmations when sorting my own claims because of timestamp issues with pending claims

This commit is contained in:
Sean Yesmunt 2020-04-01 10:37:50 -04:00
parent 07adf4aab3
commit 273c325d37
2 changed files with 25 additions and 16 deletions

23
dist/bundle.es.js vendored
View file

@ -2237,15 +2237,19 @@ const selectMyClaims = reselect.createSelector(selectMyActiveClaims, selectClaim
const selectMyClaimsWithoutChannels = reselect.createSelector(selectMyClaims, myClaims => myClaims.filter(claim => !claim.name.match(/^@/)).sort((a, b) => a.timestamp - b.timestamp));
const selectMyClaimUrisWithoutChannels = reselect.createSelector(selectMyClaimsWithoutChannels, myClaims => myClaims.sort((a, b) => {
if (!a.timestamp) {
return -1;
} else if (!b.timestamp) {
return 1;
} else {
return b.timestamp - a.timestamp;
}
}).map(claim => claim.canonical_url));
const selectMyClaimUrisWithoutChannels = reselect.createSelector(selectMyClaimsWithoutChannels, myClaims => {
return myClaims.sort((a, b) => {
if (a.height < 1) {
return -1;
} else if (b.height < 1) {
return 1;
} else {
return b.timestamp - a.timestamp;
}
}).map(claim => {
return claim.canonical_url || claim.permanent_url;
});
});
const selectAllMyClaimsByOutpoint = reselect.createSelector(selectMyClaimsRaw, claims => new Set(claims && claims.length ? claims.map(claim => `${claim.txid}:${claim.nout}`) : null));
@ -2424,6 +2428,7 @@ const selectUpdateChannelError = reselect.createSelector(selectState$2, state =>
const makeSelectMyStreamUrlsForPage = (page = 1) => reselect.createSelector(selectMyClaimUrisWithoutChannels, urls => {
const start = (Number(page) - 1) * Number(PAGE_SIZE);
const end = Number(page) * Number(PAGE_SIZE);
return urls && urls.length ? urls.slice(start, end) : [];
});

View file

@ -310,8 +310,8 @@ export const makeSelectDateForUri = (uri: string) =>
(claim.value.release_time
? claim.value.release_time * 1000
: claim.meta && claim.meta.creation_timestamp
? claim.meta.creation_timestamp * 1000
: null);
? claim.meta.creation_timestamp * 1000
: null);
if (!timestamp) {
return undefined;
}
@ -386,18 +386,21 @@ export const selectMyClaimsWithoutChannels = createSelector(
export const selectMyClaimUrisWithoutChannels = createSelector(
selectMyClaimsWithoutChannels,
myClaims =>
myClaims
myClaims => {
return myClaims
.sort((a, b) => {
if (!a.timestamp) {
if (a.height < 1) {
return -1;
} else if (!b.timestamp) {
} else if (b.height < 1) {
return 1;
} else {
return b.timestamp - a.timestamp;
}
})
.map(claim => claim.canonical_url)
.map(claim => {
return claim.canonical_url || claim.permanent_url;
});
}
);
export const selectAllMyClaimsByOutpoint = createSelector(
@ -694,6 +697,7 @@ export const makeSelectMyStreamUrlsForPage = (page: number = 1) =>
urls => {
const start = (Number(page) - 1) * Number(PAGE_SIZE);
const end = Number(page) * Number(PAGE_SIZE);
return urls && urls.length ? urls.slice(start, end) : [];
}
);