Select pending url #369
3 changed files with 44 additions and 14 deletions
22
dist/bundle.es.js
vendored
22
dist/bundle.es.js
vendored
|
@ -2461,13 +2461,25 @@ const selectPlayingUri = reselect.createSelector(selectState$1, state => state.p
|
|||
|
||||
const selectChannelClaimCounts = reselect.createSelector(selectState$1, state => state.channelClaimCounts || {});
|
||||
|
||||
const makeSelectPendingClaimUrlForName = name => reselect.createSelector(selectPendingIds, selectClaimsById, (pending, claims) => {
|
||||
const makeSelectPendingClaimForUri = uri => reselect.createSelector(selectPendingIds, selectClaimsById, (pending, claims) => {
|
||||
let uriIsChannel;
|
||||
let uriStreamName;
|
||||
let uriChannelName;
|
||||
try {
|
||||
({ isChannel: uriIsChannel, streamName: uriStreamName, channelName: uriChannelName } = parseURI(uri));
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
const pendingClaims = pending.map(id => claims[id]);
|
||||
const matchingClaim = pendingClaims.find(claim => {
|
||||
const { streamName } = parseURI(claim.permanent_url);
|
||||
return name === streamName;
|
||||
const { streamName, channelName, isChannel } = parseURI(claim.permanent_url);
|
||||
if (isChannel) {
|
||||
return channelName === uriChannelName;
|
||||
} else {
|
||||
return streamName === uriStreamName;
|
||||
}
|
||||
});
|
||||
return matchingClaim && matchingClaim.permanent_url;
|
||||
return matchingClaim || null;
|
||||
});
|
||||
|
||||
const makeSelectTotalItemsForChannel = uri => reselect.createSelector(selectChannelClaimCounts, byUri => byUri && byUri[uri]);
|
||||
|
@ -6242,7 +6254,7 @@ exports.makeSelectNsfwCountForChannel = makeSelectNsfwCountForChannel;
|
|||
exports.makeSelectNsfwCountFromUris = makeSelectNsfwCountFromUris;
|
||||
exports.makeSelectOmittedCountForChannel = makeSelectOmittedCountForChannel;
|
||||
exports.makeSelectPendingAmountByUri = makeSelectPendingAmountByUri;
|
||||
exports.makeSelectPendingClaimUrlForName = makeSelectPendingClaimUrlForName;
|
||||
exports.makeSelectPendingClaimForUri = makeSelectPendingClaimForUri;
|
||||
exports.makeSelectPermanentUrlForUri = makeSelectPermanentUrlForUri;
|
||||
exports.makeSelectPublishFormValue = makeSelectPublishFormValue;
|
||||
exports.makeSelectReflectingClaimForUri = makeSelectReflectingClaimForUri;
|
||||
|
|
|
@ -162,7 +162,7 @@ export {
|
|||
makeSelectTagInClaimOrChannelForUri,
|
||||
makeSelectContentTypeForUri,
|
||||
makeSelectIsUriResolving,
|
||||
makeSelectPendingClaimUrlForName,
|
||||
makeSelectPendingClaimForUri,
|
||||
makeSelectTotalItemsForChannel,
|
||||
makeSelectTotalPagesForChannel,
|
||||
makeSelectNsfwCountFromUris,
|
||||
|
|
|
@ -258,8 +258,8 @@ export const makeSelectMyPurchasesForPage = (query: ?string, page: number = 1) =
|
|||
const end = Number(page) * Number(PAGE_SIZE);
|
||||
return matchingFileInfos && matchingFileInfos.length
|
||||
? matchingFileInfos
|
||||
.slice(start, end)
|
||||
.map(fileInfo => fileInfo.canonical_url || fileInfo.permanent_url)
|
||||
.slice(start, end)
|
||||
.map(fileInfo => fileInfo.canonical_url || fileInfo.permanent_url)
|
||||
: [];
|
||||
}
|
||||
);
|
||||
|
@ -365,8 +365,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;
|
||||
}
|
||||
|
@ -563,17 +563,35 @@ export const selectChannelClaimCounts = createSelector(
|
|||
state => state.channelClaimCounts || {}
|
||||
);
|
||||
|
||||
export const makeSelectPendingClaimUrlForName = (name: string) =>
|
||||
export const makeSelectPendingClaimForUri = (uri: string) =>
|
||||
createSelector(
|
||||
selectPendingIds,
|
||||
selectClaimsById,
|
||||
(pending, claims) => {
|
||||
let validUri;
|
||||
let uriIsChannel;
|
||||
let uriStreamName;
|
||||
let uriChannelName;
|
||||
try {
|
||||
({
|
||||
isChannel: uriIsChannel,
|
||||
streamName: uriStreamName,
|
||||
channelName: uriChannelName,
|
||||
} = parseURI(uri));
|
||||
validUri = true;
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
const pendingClaims = pending.map(id => claims[id]);
|
||||
const matchingClaim = pendingClaims.find(claim => {
|
||||
const { streamName } = parseURI(claim.permanent_url);
|
||||
return name === streamName;
|
||||
const { streamName, channelName, isChannel } = parseURI(claim.permanent_url);
|
||||
if (isChannel) {
|
||||
return channelName === uriChannelName;
|
||||
} else {
|
||||
return streamName === uriStreamName;
|
||||
}
|
||||
});
|
||||
return matchingClaim && matchingClaim.permanent_url;
|
||||
return matchingClaim || null;
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue