Select pending url #369

Merged
jessopb merged 5 commits from selectPendingUrl into master 2020-12-16 16:19:51 +01:00
4 changed files with 39 additions and 0 deletions
Showing only changes of commit 034838a23c - Show all commits

17
dist/bundle.es.js vendored
View file

@ -2457,6 +2457,15 @@ const selectPlayingUri = reselect.createSelector(selectState$1, state => state.p
const selectChannelClaimCounts = reselect.createSelector(selectState$1, state => state.channelClaimCounts || {}); const selectChannelClaimCounts = reselect.createSelector(selectState$1, state => state.channelClaimCounts || {});
const makeSelectPendingClaimUrlForName = name => reselect.createSelector(selectPendingIds, selectClaimsById, (pending, claims) => {
const pendingClaims = pending.map(id => claims[id]);
const matchingClaim = pendingClaims.find(claim => {
const { streamName } = parseURI(claim.permanent_url);
return name === streamName;
});
return matchingClaim && matchingClaim.permanent_url;
});
const makeSelectTotalItemsForChannel = uri => reselect.createSelector(selectChannelClaimCounts, byUri => byUri && byUri[uri]); const makeSelectTotalItemsForChannel = uri => reselect.createSelector(selectChannelClaimCounts, byUri => byUri && byUri[uri]);
const makeSelectTotalPagesForChannel = (uri, pageSize = 10) => reselect.createSelector(selectChannelClaimCounts, byUri => byUri && byUri[uri] && Math.ceil(byUri[uri] / pageSize)); const makeSelectTotalPagesForChannel = (uri, pageSize = 10) => reselect.createSelector(selectChannelClaimCounts, byUri => byUri && byUri[uri] && Math.ceil(byUri[uri] / pageSize));
@ -3684,6 +3693,12 @@ function doRepost(options) {
repostClaim repostClaim
} }
}); });
dispatch({
type: UPDATE_PENDING_CLAIMS,
data: {
claims: [repostClaim]
}
});
dispatch(doFetchClaimListMine(1, 10)); dispatch(doFetchClaimListMine(1, 10));
resolve(repostClaim); resolve(repostClaim);
@ -6222,6 +6237,7 @@ exports.makeSelectNsfwCountForChannel = makeSelectNsfwCountForChannel;
exports.makeSelectNsfwCountFromUris = makeSelectNsfwCountFromUris; exports.makeSelectNsfwCountFromUris = makeSelectNsfwCountFromUris;
exports.makeSelectOmittedCountForChannel = makeSelectOmittedCountForChannel; exports.makeSelectOmittedCountForChannel = makeSelectOmittedCountForChannel;
exports.makeSelectPendingAmountByUri = makeSelectPendingAmountByUri; exports.makeSelectPendingAmountByUri = makeSelectPendingAmountByUri;
exports.makeSelectPendingClaimUrlForName = makeSelectPendingClaimUrlForName;
exports.makeSelectPermanentUrlForUri = makeSelectPermanentUrlForUri; exports.makeSelectPermanentUrlForUri = makeSelectPermanentUrlForUri;
exports.makeSelectPublishFormValue = makeSelectPublishFormValue; exports.makeSelectPublishFormValue = makeSelectPublishFormValue;
exports.makeSelectReflectingClaimForUri = makeSelectReflectingClaimForUri; exports.makeSelectReflectingClaimForUri = makeSelectReflectingClaimForUri;
@ -6313,6 +6329,7 @@ exports.selectMyClaimsWithoutChannels = selectMyClaimsWithoutChannels;
exports.selectMyPurchases = selectMyPurchases; exports.selectMyPurchases = selectMyPurchases;
exports.selectMyPurchasesCount = selectMyPurchasesCount; exports.selectMyPurchasesCount = selectMyPurchasesCount;
exports.selectMyStreamUrlsCount = selectMyStreamUrlsCount; exports.selectMyStreamUrlsCount = selectMyStreamUrlsCount;
exports.selectPendingIds = selectPendingIds;
exports.selectPendingSupportTransactions = selectPendingSupportTransactions; exports.selectPendingSupportTransactions = selectPendingSupportTransactions;
exports.selectPlayingUri = selectPlayingUri; exports.selectPlayingUri = selectPlayingUri;
exports.selectPublishFormValues = selectPublishFormValues; exports.selectPublishFormValues = selectPublishFormValues;

View file

@ -161,6 +161,7 @@ export {
makeSelectTagInClaimOrChannelForUri, makeSelectTagInClaimOrChannelForUri,
makeSelectContentTypeForUri, makeSelectContentTypeForUri,
makeSelectIsUriResolving, makeSelectIsUriResolving,
makeSelectPendingClaimUrlForName,
makeSelectTotalItemsForChannel, makeSelectTotalItemsForChannel,
makeSelectTotalPagesForChannel, makeSelectTotalPagesForChannel,
makeSelectNsfwCountFromUris, makeSelectNsfwCountFromUris,
@ -181,6 +182,7 @@ export {
makeSelectClaimWasPurchased, makeSelectClaimWasPurchased,
makeSelectAbandoningClaimById, makeSelectAbandoningClaimById,
makeSelectIsAbandoningClaimForUri, makeSelectIsAbandoningClaimForUri,
selectPendingIds,
selectReflectingById, selectReflectingById,
selectClaimsById, selectClaimsById,
selectClaimsByUri, selectClaimsByUri,

View file

@ -611,6 +611,12 @@ export function doRepost(options: StreamRepostOptions) {
repostClaim, repostClaim,
}, },
}); });
dispatch({
type: ACTIONS.UPDATE_PENDING_CLAIMS,
data: {
claims: [repostClaim],
},
});
dispatch(doFetchClaimListMine(1, 10)); dispatch(doFetchClaimListMine(1, 10));
resolve(repostClaim); resolve(repostClaim);

View file

@ -555,6 +555,20 @@ export const selectChannelClaimCounts = createSelector(
state => state.channelClaimCounts || {} state => state.channelClaimCounts || {}
); );
export const makeSelectPendingClaimUrlForName = (name: string) =>
createSelector(
selectPendingIds,
selectClaimsById,
(pending, claims) => {
const pendingClaims = pending.map(id => claims[id]);
const matchingClaim = pendingClaims.find(claim => {
const { streamName } = parseURI(claim.permanent_url);
return name === streamName;
});
return matchingClaim && matchingClaim.permanent_url;
}
);
export const makeSelectTotalItemsForChannel = (uri: string) => export const makeSelectTotalItemsForChannel = (uri: string) =>
createSelector( createSelector(
selectChannelClaimCounts, selectChannelClaimCounts,