From d6f7ac731d496ab296c03cfdc07b80b87c3f7583 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Thu, 8 Nov 2018 16:49:58 -0500 Subject: [PATCH] add claim to claimsByUri after claim_list_mine --- dist/bundle.js | 8 ++++++++ src/redux/reducers/claims.js | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/dist/bundle.js b/dist/bundle.js index 58f0b89..d6a9003 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -5192,6 +5192,8 @@ var _action_types = __webpack_require__(4); var ACTIONS = _interopRequireWildcard(_action_types); +var _lbryURI = __webpack_require__(2); + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } var reducers = {}; @@ -5263,15 +5265,20 @@ reducers[ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED] = function (state, action) { var claims = action.data.claims; var byId = Object.assign({}, state.byId); + var byUri = Object.assign({}, state.claimsByUri); var pendingById = Object.assign({}, state.pendingById); claims.forEach(function (claim) { + var uri = (0, _lbryURI.buildURI)({ claimName: claim.name, claimId: claim.claim_id }); + if (claim.type && claim.type.match(/claim|update/)) { if (claim.confirmations < 1) { pendingById[claim.claim_id] = claim; delete byId[claim.claim_id]; + delete byUri[claim.claim_id]; } else { byId[claim.claim_id] = claim; + byUri[uri] = claim.claim_id; } } }); @@ -5287,6 +5294,7 @@ reducers[ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED] = function (state, action) { isFetchingClaimListMine: false, myClaims: claims, byId: byId, + claimsByUri: byUri, pendingById: pendingById }); }; diff --git a/src/redux/reducers/claims.js b/src/redux/reducers/claims.js index dc66347..f0615a0 100644 --- a/src/redux/reducers/claims.js +++ b/src/redux/reducers/claims.js @@ -1,4 +1,5 @@ import * as ACTIONS from 'constants/action_types'; +import { buildURI } from 'lbryURI'; const reducers = {}; @@ -52,15 +53,20 @@ reducers[ACTIONS.FETCH_CLAIM_LIST_MINE_STARTED] = (state) => reducers[ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED] = (state, action) => { const { claims } = action.data; const byId = Object.assign({}, state.byId); + const byUri = Object.assign({}, state.claimsByUri); const pendingById = Object.assign({}, state.pendingById); claims.forEach((claim) => { + const uri = buildURI({ claimName: claim.name, claimId: claim.claim_id }); + if (claim.type && claim.type.match(/claim|update/)) { if (claim.confirmations < 1) { pendingById[claim.claim_id] = claim; delete byId[claim.claim_id]; + delete byUri[claim.claim_id]; } else { byId[claim.claim_id] = claim; + byUri[uri] = claim.claim_id; } } }); @@ -76,6 +82,7 @@ reducers[ACTIONS.FETCH_CLAIM_LIST_MINE_COMPLETED] = (state, action) => { isFetchingClaimListMine: false, myClaims: claims, byId, + claimsByUri: byUri, pendingById, }); };