This commit is contained in:
jessop 2020-06-17 09:56:59 -04:00
parent b32f6d0ddc
commit 36f36cea8e
4 changed files with 30 additions and 37 deletions

37
dist/bundle.es.js vendored
View file

@ -2204,7 +2204,7 @@ const selectAllClaimsByChannel = reselect.createSelector(selectState$2, state =>
const selectPendingIds = reselect.createSelector(selectState$2, state => state.pendingIds || []);
const makeSelectClaimIsPending = uri => reselect.createSelector(selectClaimIdsByUri, selectPendingIds, (idsByUri, pendingIds) => {
const claimId = idsByUri(normalizeURI(uri));
const claimId = idsByUri[normalizeURI(uri)];
if (claimId) {
return pendingIds.some(i => i === claimId);
@ -2423,8 +2423,6 @@ const selectMyClaimUrisWithoutChannels = reselect.createSelector(selectMyClaimsW
});
});
const selectMyChannelUrls = reselect.createSelector(selectState$2, state => state.myChannelUrls);
const selectAllMyClaimsByOutpoint = reselect.createSelector(selectMyClaimsRaw, claims => new Set(claims && claims.length ? claims.map(claim => `${claim.txid}:${claim.nout}`) : null));
const selectMyClaimsOutpoints = reselect.createSelector(selectMyClaims, myClaims => {
@ -2454,6 +2452,8 @@ const selectMyChannelClaims = reselect.createSelector(selectState$2, selectClaim
return claims;
});
const selectMyChannelUrls = reselect.createSelector(selectMyChannelClaims, claims => claims ? claims.map(claim => claim.canonical_url || claim.permanent_url) : undefined);
const selectResolvingUris = reselect.createSelector(selectState$2, state => state.resolvingUris || []);
const selectChannelImportPending = reselect.createSelector(selectState$2, state => state.pendingChannelImport);
@ -2857,8 +2857,8 @@ function doSendDraftTransaction(address, amount) {
if (balance - amount <= 0) {
dispatch(doToast({
title: 'Insufficient credits',
message: 'Insufficient credits'
title: __('Insufficient credits'),
message: __('Insufficient credits')
}));
return;
}
@ -2873,8 +2873,8 @@ function doSendDraftTransaction(address, amount) {
type: SEND_TRANSACTION_COMPLETED
});
dispatch(doToast({
message: `You sent ${amount} LBC`,
linkText: 'History',
message: __('You sent ${amount} LBC'),
linkText: __('History'),
linkTarget: '/wallet'
}));
} else {
@ -2883,7 +2883,7 @@ function doSendDraftTransaction(address, amount) {
data: { error: response }
});
dispatch(doToast({
message: 'Transaction failed',
message: __('Transaction failed'),
isError: true
}));
}
@ -2895,7 +2895,7 @@ function doSendDraftTransaction(address, amount) {
data: { error: error.message }
});
dispatch(doToast({
message: 'Transaction failed',
message: __('Transaction failed'),
isError: true
}));
};
@ -2941,7 +2941,7 @@ function doSendTip(params, isSupport, successCallback, errorCallback) {
dispatch(doToast({
message: shouldSupport ? __('You deposited %amount% LBC as a support!', { amount: params.amount }) : __('You sent %amount% LBC as a tip, Mahalo!', { amount: params.amount }),
linkText: __('History'),
linkTarget: __('/wallet')
linkTarget: '/wallet'
}));
dispatch({
@ -3534,7 +3534,9 @@ function doCreateChannel(name, amount, optionalParams, cb) {
});
dispatch({
type: UPDATE_PENDING_CLAIMS,
data: [channelClaim]
data: {
claims: [channelClaim]
}
});
dispatch(doCheckPendingClaims(cb));
return channelClaim;
@ -3600,6 +3602,7 @@ function doUpdateChannel(params, cb) {
}
});
dispatch(doCheckPendingClaims(cb));
return Boolean(result.outputs[0]);
}).then().catch(error => {
dispatch({
type: UPDATE_CHANNEL_FAILED,
@ -5128,7 +5131,6 @@ const defaultState = {
fetchingChannelClaims: {},
resolvingUris: [],
myChannelClaims: undefined,
myChannelUrls: undefined,
myClaims: undefined,
myPurchases: undefined,
myPurchasesPageNumber: undefined,
@ -5178,7 +5180,7 @@ function handleClaimAction(state, action) {
if (stream) {
if (pendingIds.includes(stream.claim_id)) {
byId[stream.claim_id] = mergeClaims(stream, byId[stream.claim_id]); // merge them
byId[stream.claim_id] = mergeClaims(stream, byId[stream.claim_id]);
} else {
byId[stream.claim_id] = stream;
}
@ -5277,7 +5279,7 @@ reducers[FETCH_CLAIM_LIST_MINE_COMPLETED] = (state, action) => {
if (pendingIds.includes(claimId)) {
byId[claimId] = mergeClaims(claim, byId[claimId]);
} else {
byId[claimId] = claim; // just add
byId[claimId] = claim;
}
byUri[permanentUri] = claimId;
myClaimIds.add(claimId);
@ -5304,7 +5306,6 @@ reducers[FETCH_CHANNEL_LIST_COMPLETED] = (state, action) => {
let myClaimIds = new Set(state.myClaims);
const pendingIds = state.pendingIds || [];
let myChannelClaims;
let myChannelUrls = [];
const byId = Object.assign({}, state.byId);
const byUri = Object.assign({}, state.claimsByUri);
const channelClaimCounts = Object.assign({}, state.channelClaimCounts);
@ -5312,10 +5313,8 @@ reducers[FETCH_CHANNEL_LIST_COMPLETED] = (state, action) => {
if (!claims.length) {
// $FlowFixMe
myChannelClaims = null;
myChannelUrls = null;
} else {
myChannelClaims = new Set(state.myChannelClaims);
myChannelUrls = [];
claims.forEach(claim => {
const { claims_in_channel: claimsInChannel } = claim.meta;
const { canonical_url: canonicalUrl, permanent_url: permanentUrl, claim_id: claimId } = claim;
@ -5330,7 +5329,6 @@ reducers[FETCH_CHANNEL_LIST_COMPLETED] = (state, action) => {
if (!pendingIds.some(c => c === claimId)) {
byId[claimId] = claim;
}
myChannelUrls.push(permanentUrl);
myClaimIds.add(claimId);
});
}
@ -5341,8 +5339,7 @@ reducers[FETCH_CHANNEL_LIST_COMPLETED] = (state, action) => {
channelClaimCounts,
fetchingMyChannels: false,
myChannelClaims: myChannelClaims ? Array.from(myChannelClaims) : null,
myClaims: myClaimIds ? Array.from(myClaimIds) : null,
myChannelUrls
myClaims: myClaimIds ? Array.from(myClaimIds) : null
});
};

View file

@ -398,7 +398,9 @@ export function doCreateChannel(name: string, amount: number, optionalParams: an
});
dispatch({
type: ACTIONS.UPDATE_PENDING_CLAIMS,
data: [channelClaim],
data: {
claims: [channelClaim],
},
});
dispatch(doCheckPendingClaims(cb));
return channelClaim;
@ -467,6 +469,7 @@ export function doUpdateChannel(params: any, cb: any) {
},
});
dispatch(doCheckPendingClaims(cb));
return Boolean(result.outputs[0]);
})
.then()
.catch(error => {

View file

@ -21,7 +21,6 @@ type State = {
reflectingById: { [string]: ReflectingUpdate },
myClaims: ?Array<string>,
myChannelClaims: ?Array<string>,
myChannelUrls: ?Array<string>,
abandoningById: { [string]: boolean },
fetchingChannelClaims: { [string]: number },
fetchingMyChannels: boolean,
@ -67,7 +66,6 @@ const defaultState = {
fetchingChannelClaims: {},
resolvingUris: [],
myChannelClaims: undefined,
myChannelUrls: undefined,
myClaims: undefined,
myPurchases: undefined,
myPurchasesPageNumber: undefined,
@ -123,7 +121,7 @@ function handleClaimAction(state: State, action: any): State {
if (stream) {
if (pendingIds.includes(stream.claim_id)) {
byId[stream.claim_id] = mergeClaim(stream, byId[stream.claim_id]);// merge them
byId[stream.claim_id] = mergeClaim(stream, byId[stream.claim_id]);
} else {
byId[stream.claim_id] = stream;
}
@ -214,7 +212,7 @@ reducers[ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED] = (state: State, action: any):
const pendingIdSet = new Set(pendingIds);
claims.forEach((claim: Claim) => {
const { permanent_url: permanentUri, claim_id: claimId } = claim;
const { permanent_url: permanentUri, claim_id: claimId } = claim;
if (claim.type && claim.type.match(/claim|update/)) {
urlsForCurrentPage.push(permanentUri);
if (claim.confirmations < 1) {
@ -225,7 +223,7 @@ reducers[ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED] = (state: State, action: any):
if (pendingIds.includes(claimId)) {
byId[claimId] = mergeClaim(claim, byId[claimId]);
} else {
byId[claimId] = claim;// just add
byId[claimId] = claim;
}
byUri[permanentUri] = claimId;
myClaimIds.add(claimId);
@ -253,7 +251,6 @@ reducers[ACTIONS.FETCH_CHANNEL_LIST_COMPLETED] = (state: State, action: any): St
let myClaimIds = new Set(state.myClaims);
const pendingIds = state.pendingIds || [];
let myChannelClaims;
let myChannelUrls = [];
const byId = Object.assign({}, state.byId);
const byUri = Object.assign({}, state.claimsByUri);
const channelClaimCounts = Object.assign({}, state.channelClaimCounts);
@ -261,10 +258,8 @@ reducers[ACTIONS.FETCH_CHANNEL_LIST_COMPLETED] = (state: State, action: any): St
if (!claims.length) {
// $FlowFixMe
myChannelClaims = null;
myChannelUrls = null;
} else {
myChannelClaims = new Set(state.myChannelClaims);
myChannelUrls = [];
claims.forEach(claim => {
const { meta } = claim;
const { claims_in_channel: claimsInChannel } = claim.meta;
@ -280,7 +275,6 @@ reducers[ACTIONS.FETCH_CHANNEL_LIST_COMPLETED] = (state: State, action: any): St
if (!pendingIds.some(c => c === claimId)) {
byId[claimId] = claim;
}
myChannelUrls.push(permanentUrl);
myClaimIds.add(claimId);
});
}
@ -292,7 +286,6 @@ reducers[ACTIONS.FETCH_CHANNEL_LIST_COMPLETED] = (state: State, action: any): St
fetchingMyChannels: false,
myChannelClaims: myChannelClaims ? Array.from(myChannelClaims) : null,
myClaims: myClaimIds ? Array.from(myClaimIds) : null,
myChannelUrls,
});
};

View file

@ -85,7 +85,7 @@ export const makeSelectClaimIsPending = (uri: string) =>
selectClaimIdsByUri,
selectPendingIds,
(idsByUri, pendingIds) => {
const claimId = idsByUri(normalizeURI(uri));
const claimId = idsByUri[normalizeURI(uri)];
if (claimId) {
return pendingIds.some(i => i === claimId);
@ -467,11 +467,6 @@ export const selectMyClaimUrisWithoutChannels = createSelector(
}
);
export const selectMyChannelUrls = createSelector(
selectState,
state => state.myChannelUrls
);
export const selectAllMyClaimsByOutpoint = createSelector(
selectMyClaimsRaw,
claims =>
@ -515,6 +510,11 @@ export const selectMyChannelClaims = createSelector(
}
);
export const selectMyChannelUrls = createSelector(
selectMyChannelClaims,
claims => claims ? claims.map(claim => claim.canonical_url || claim.permanent_url) : undefined
);
export const selectResolvingUris = createSelector(
selectState,
state => state.resolvingUris || []