From 0aeb6e175f3bfbf8730c904171b42b21d1ecc908 Mon Sep 17 00:00:00 2001 From: jessop Date: Wed, 16 Oct 2019 13:32:50 -0400 Subject: [PATCH 1/2] update myclaims on Abandon Succeeded --- dist/bundle.es.js | 19 ++++++++++++++++--- src/redux/actions/claims.js | 2 +- src/redux/reducers/claims.js | 5 +++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 8717d44..4ef8b57 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -1079,6 +1079,18 @@ function buildURI(UrlObj, includeProto = true, protoDefault = 'lbry://') { deprecatedParts = _objectWithoutProperties(UrlObj, ['streamName', 'streamClaimId', 'channelName', 'channelClaimId', 'primaryClaimSequence', 'primaryBidPosition', 'secondaryClaimSequence', 'secondaryBidPosition']); const { claimId, claimName, contentName } = deprecatedParts; + { + if (claimId) { + console.error(__("'claimId' should no longer be used. Use 'streamClaimId' or 'channelClaimId' instead")); + } + if (claimName) { + console.error(__("'claimName' should no longer be used. Use 'streamClaimName' or 'channelClaimName' instead")); + } + if (contentName) { + console.error(__("'contentName' should no longer be used. Use 'streamName' instead")); + } + } + if (!claimName && !channelName && !streamName) { console.error(__("'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url.")); } @@ -2605,7 +2617,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 +4012,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 +4143,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 +4151,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, { diff --git a/src/redux/actions/claims.js b/src/redux/actions/claims.js index 02e19b5..3dffd6b 100644 --- a/src/redux/actions/claims.js +++ b/src/redux/actions/claims.js @@ -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({ diff --git a/src/redux/reducers/claims.js b/src/redux/reducers/claims.js index b82b56a..8f08dc3 100644 --- a/src/redux/reducers/claims.js +++ b/src/redux/reducers/claims.js @@ -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, { From 69f8022b1f855a0efa67bdd1591f9505672ab225 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 16 Oct 2019 19:53:25 -0400 Subject: [PATCH 2/2] build --- dist/bundle.es.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 4ef8b57..509bc03 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -1079,18 +1079,6 @@ function buildURI(UrlObj, includeProto = true, protoDefault = 'lbry://') { deprecatedParts = _objectWithoutProperties(UrlObj, ['streamName', 'streamClaimId', 'channelName', 'channelClaimId', 'primaryClaimSequence', 'primaryBidPosition', 'secondaryClaimSequence', 'secondaryBidPosition']); const { claimId, claimName, contentName } = deprecatedParts; - { - if (claimId) { - console.error(__("'claimId' should no longer be used. Use 'streamClaimId' or 'channelClaimId' instead")); - } - if (claimName) { - console.error(__("'claimName' should no longer be used. Use 'streamClaimName' or 'channelClaimName' instead")); - } - if (contentName) { - console.error(__("'contentName' should no longer be used. Use 'streamName' instead")); - } - } - if (!claimName && !channelName && !streamName) { console.error(__("'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url.")); }