check for confirmations when sorting my own claims because of timestamp issues with pending claims
This commit is contained in:
parent
07adf4aab3
commit
273c325d37
2 changed files with 25 additions and 16 deletions
13
dist/bundle.es.js
vendored
13
dist/bundle.es.js
vendored
|
@ -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 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) => {
|
const selectMyClaimUrisWithoutChannels = reselect.createSelector(selectMyClaimsWithoutChannels, myClaims => {
|
||||||
if (!a.timestamp) {
|
return myClaims.sort((a, b) => {
|
||||||
|
if (a.height < 1) {
|
||||||
return -1;
|
return -1;
|
||||||
} else if (!b.timestamp) {
|
} else if (b.height < 1) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return b.timestamp - a.timestamp;
|
return b.timestamp - a.timestamp;
|
||||||
}
|
}
|
||||||
}).map(claim => claim.canonical_url));
|
}).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));
|
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 makeSelectMyStreamUrlsForPage = (page = 1) => reselect.createSelector(selectMyClaimUrisWithoutChannels, urls => {
|
||||||
const start = (Number(page) - 1) * Number(PAGE_SIZE);
|
const start = (Number(page) - 1) * Number(PAGE_SIZE);
|
||||||
const end = Number(page) * Number(PAGE_SIZE);
|
const end = Number(page) * Number(PAGE_SIZE);
|
||||||
|
|
||||||
return urls && urls.length ? urls.slice(start, end) : [];
|
return urls && urls.length ? urls.slice(start, end) : [];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -386,18 +386,21 @@ export const selectMyClaimsWithoutChannels = createSelector(
|
||||||
|
|
||||||
export const selectMyClaimUrisWithoutChannels = createSelector(
|
export const selectMyClaimUrisWithoutChannels = createSelector(
|
||||||
selectMyClaimsWithoutChannels,
|
selectMyClaimsWithoutChannels,
|
||||||
myClaims =>
|
myClaims => {
|
||||||
myClaims
|
return myClaims
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
if (!a.timestamp) {
|
if (a.height < 1) {
|
||||||
return -1;
|
return -1;
|
||||||
} else if (!b.timestamp) {
|
} else if (b.height < 1) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return b.timestamp - a.timestamp;
|
return b.timestamp - a.timestamp;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.map(claim => claim.canonical_url)
|
.map(claim => {
|
||||||
|
return claim.canonical_url || claim.permanent_url;
|
||||||
|
});
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export const selectAllMyClaimsByOutpoint = createSelector(
|
export const selectAllMyClaimsByOutpoint = createSelector(
|
||||||
|
@ -694,6 +697,7 @@ export const makeSelectMyStreamUrlsForPage = (page: number = 1) =>
|
||||||
urls => {
|
urls => {
|
||||||
const start = (Number(page) - 1) * Number(PAGE_SIZE);
|
const start = (Number(page) - 1) * Number(PAGE_SIZE);
|
||||||
const end = Number(page) * Number(PAGE_SIZE);
|
const end = Number(page) * Number(PAGE_SIZE);
|
||||||
|
|
||||||
return urls && urls.length ? urls.slice(start, end) : [];
|
return urls && urls.length ? urls.slice(start, end) : [];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue