Merge pull request #225 from lbryio/myClaimsAbandon

update myclaims on Abandon Succeeded
This commit is contained in:
Sean Yesmunt 2019-10-16 19:53:38 -04:00 committed by GitHub
commit e90056aedd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

7
dist/bundle.es.js vendored
View file

@ -2605,7 +2605,7 @@ function doAbandonClaim(txid, nout) {
const isClaim = !!claimToAbandon;
const startedActionType = isClaim ? ABANDON_CLAIM_STARTED : ABANDON_SUPPORT_STARTED;
const completedActionType = isClaim ? ABANDON_CLAIM_STARTED : ABANDON_SUPPORT_COMPLETED;
const completedActionType = isClaim ? ABANDON_CLAIM_SUCCEEDED : ABANDON_SUPPORT_COMPLETED;
dispatch({
type: startedActionType,
@ -4000,7 +4000,7 @@ reducers[FETCH_CLAIM_LIST_MINE_COMPLETED] = (state, action) => {
const byId = Object.assign({}, state.byId);
const byUri = Object.assign({}, state.claimsByUri);
const pendingById = Object.assign({}, state.pendingById);
const myClaims = state.myClaims || [];
const myClaims = state.myClaims ? state.myClaims.slice() : [];
claims.forEach(claim => {
const uri = buildURI({ streamName: claim.name, streamClaimId: claim.claim_id });
@ -4131,6 +4131,7 @@ reducers[ABANDON_CLAIM_STARTED] = (state, action) => {
reducers[ABANDON_CLAIM_SUCCEEDED] = (state, action) => {
const { claimId } = action.data;
const byId = Object.assign({}, state.byId);
const newMyClaims = state.myClaims ? state.myClaims.slice() : [];
const claimsByUri = Object.assign({}, state.claimsByUri);
Object.keys(claimsByUri).forEach(uri => {
@ -4138,7 +4139,7 @@ reducers[ABANDON_CLAIM_SUCCEEDED] = (state, action) => {
delete claimsByUri[uri];
}
});
const myClaims = newMyClaims.filter(i => i.claim_id && i.claim_id !== claimId);
delete byId[claimId];
return Object.assign({}, state, {

View file

@ -137,7 +137,7 @@ export function doAbandonClaim(txid: string, nout: number) {
? ACTIONS.ABANDON_CLAIM_STARTED
: ACTIONS.ABANDON_SUPPORT_STARTED;
const completedActionType = isClaim
? ACTIONS.ABANDON_CLAIM_STARTED
? ACTIONS.ABANDON_CLAIM_SUCCEEDED
: ACTIONS.ABANDON_SUPPORT_COMPLETED;
dispatch({

View file

@ -156,7 +156,7 @@ reducers[ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED] = (state: State, action: any):
const byId = Object.assign({}, state.byId);
const byUri = Object.assign({}, state.claimsByUri);
const pendingById: { [string]: Claim } = Object.assign({}, state.pendingById);
const myClaims = state.myClaims || [];
const myClaims = state.myClaims ? state.myClaims.slice() : [];
claims.forEach((claim: Claim) => {
const uri = buildURI({ streamName: claim.name, streamClaimId: claim.claim_id });
@ -289,6 +289,7 @@ reducers[ACTIONS.ABANDON_CLAIM_STARTED] = (state: State, action: any): State =>
reducers[ACTIONS.ABANDON_CLAIM_SUCCEEDED] = (state: State, action: any): State => {
const { claimId }: { claimId: string } = action.data;
const byId = Object.assign({}, state.byId);
const newMyClaims = state.myClaims ? state.myClaims.slice() : [];
const claimsByUri = Object.assign({}, state.claimsByUri);
Object.keys(claimsByUri).forEach(uri => {
@ -296,7 +297,7 @@ reducers[ACTIONS.ABANDON_CLAIM_SUCCEEDED] = (state: State, action: any): State =
delete claimsByUri[uri];
}
});
const myClaims = newMyClaims.filter(i => i.claim_id && i.claim_id !== claimId);
delete byId[claimId];
return Object.assign({}, state, {