handle repost claims #269

Merged
neb-b merged 1 commit from reposts into master 2020-01-30 23:17:54 +01:00
4 changed files with 152 additions and 123 deletions
Showing only changes of commit f77bee9cf1 - Show all commits

255
dist/bundle.es.js vendored
View file

@ -1934,7 +1934,7 @@ function concatClaims(claimList = [], concatClaimList = []) {
return claims; return claims;
} }
// var _extends$4 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
const selectState$2 = state => state.claims || {}; const selectState$2 = state => state.claims || {};
const selectClaimsById = reselect.createSelector(selectState$2, state => state.byId || {}); const selectClaimsById = reselect.createSelector(selectState$2, state => state.byId || {});
@ -2003,7 +2003,7 @@ const makeSelectClaimForUri = uri => reselect.createSelector(selectClaimsByUri,
valid = true; valid = true;
} catch (e) {} } catch (e) {}
if (valid) { if (valid && byUri) {
const claimId = isChannel ? channelClaimId : streamClaimId; const claimId = isChannel ? channelClaimId : streamClaimId;
const pendingClaim = pendingById[claimId]; const pendingClaim = pendingById[claimId];
@ -2011,7 +2011,20 @@ const makeSelectClaimForUri = uri => reselect.createSelector(selectClaimsByUri,
return pendingClaim; return pendingClaim;
} }
return byUri && byUri[normalizeURI(uri)]; const claim = byUri[normalizeURI(uri)];
if (claim === undefined || claim === null) {
// Make sure to return the claim as is so apps can check if it's been resolved before (null) or still needs to be resolved (undefined)
return claim;
}
const repostedClaim = claim.reposted_claim;
if (repostedClaim) {
return _extends$4({}, repostedClaim, {
repost_channel_url: claim.canonical_url
});
} else {
return claim;
}
} }
}); });
@ -2767,7 +2780,7 @@ function batchActions(...actions) {
}; };
} }
var _extends$4 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _extends$5 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function doResolveUris(uris, returnCachedClaims = false) { function doResolveUris(uris, returnCachedClaims = false) {
return (dispatch, getState) => { return (dispatch, getState) => {
@ -2807,7 +2820,7 @@ function doResolveUris(uris, returnCachedClaims = false) {
// https://github.com/facebook/flow/issues/2221 // https://github.com/facebook/flow/issues/2221
if (uriResolveInfo) { if (uriResolveInfo) {
if (uriResolveInfo.error) { if (uriResolveInfo.error) {
resolveInfo[uri] = _extends$4({}, fallbackResolveInfo); resolveInfo[uri] = _extends$5({}, fallbackResolveInfo);
} else { } else {
let result = {}; let result = {};
if (uriResolveInfo.value_type === 'channel') { if (uriResolveInfo.value_type === 'channel') {
@ -3497,7 +3510,7 @@ function doSetFileListSort(page, value) {
}; };
} }
var _extends$5 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _extends$6 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties$2(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } function _objectWithoutProperties$2(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
@ -3540,7 +3553,7 @@ const selectPublishFormValues = reselect.createSelector(selectState$5, selectIsS
} else { } else {
actualLanguage = language || 'en'; actualLanguage = language || 'en';
} }
return _extends$5({}, formValues, { language: actualLanguage }); return _extends$6({}, formValues, { language: actualLanguage });
}); });
const makeSelectPublishFormValue = item => reselect.createSelector(selectState$5, state => state[item]); const makeSelectPublishFormValue = item => reselect.createSelector(selectState$5, state => state[item]);
@ -3595,7 +3608,7 @@ const selectTakeOverAmount = reselect.createSelector(selectState$5, selectMyClai
return null; return null;
}); });
var _extends$6 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _extends$7 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
const doResetThumbnailStatus = () => dispatch => { const doResetThumbnailStatus = () => dispatch => {
dispatch({ dispatch({
@ -3633,7 +3646,7 @@ const doClearPublish = () => dispatch => {
const doUpdatePublishForm = publishFormValue => dispatch => dispatch({ const doUpdatePublishForm = publishFormValue => dispatch => dispatch({
type: UPDATE_PUBLISH_FORM, type: UPDATE_PUBLISH_FORM,
data: _extends$6({}, publishFormValue) data: _extends$7({}, publishFormValue)
}); });
const doUploadThumbnail = (filePath, thumbnailBlob, fsAdapter, fs, path) => dispatch => { const doUploadThumbnail = (filePath, thumbnailBlob, fsAdapter, fs, path) => dispatch => {
@ -4381,7 +4394,7 @@ const doToggleBlockChannel = uri => ({
} }
}); });
var _extends$7 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _extends$8 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
const reducers = {}; const reducers = {};
const defaultState = { const defaultState = {
@ -4484,7 +4497,7 @@ reducers[RESOLVE_URIS_STARTED] = (state, action) => {
}; };
reducers[RESOLVE_URIS_COMPLETED] = (state, action) => { reducers[RESOLVE_URIS_COMPLETED] = (state, action) => {
return _extends$7({}, handleClaimAction(state, action)); return _extends$8({}, handleClaimAction(state, action));
}; };
reducers[FETCH_CLAIM_LIST_MINE_STARTED] = state => Object.assign({}, state, { reducers[FETCH_CLAIM_LIST_MINE_STARTED] = state => Object.assign({}, state, {
@ -4657,7 +4670,7 @@ reducers[ABANDON_CLAIM_SUCCEEDED] = (state, action) => {
}); });
}; };
reducers[CREATE_CHANNEL_STARTED] = state => _extends$7({}, state, { reducers[CREATE_CHANNEL_STARTED] = state => _extends$8({}, state, {
creatingChannel: true, creatingChannel: true,
createChannelError: null createChannelError: null
}); });
@ -4745,7 +4758,7 @@ reducers[CLAIM_SEARCH_COMPLETED] = (state, action) => {
delete fetchingClaimSearchByQuery[query]; delete fetchingClaimSearchByQuery[query];
return Object.assign({}, state, _extends$7({}, handleClaimAction(state, action), { return Object.assign({}, state, _extends$8({}, handleClaimAction(state, action), {
claimSearchByQuery, claimSearchByQuery,
claimSearchByQueryLastPageReached, claimSearchByQueryLastPageReached,
fetchingClaimSearchByQuery fetchingClaimSearchByQuery
@ -4785,7 +4798,7 @@ const handleActions = (actionMap, defaultState) => (state = defaultState, action
return state; return state;
}; };
var _extends$8 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _extends$9 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
const defaultState$1 = { const defaultState$1 = {
commentById: {}, // commentId -> Comment commentById: {}, // commentId -> Comment
@ -4796,11 +4809,11 @@ const defaultState$1 = {
}; };
const commentReducer = handleActions({ const commentReducer = handleActions({
[COMMENT_CREATE_STARTED]: (state, action) => _extends$8({}, state, { [COMMENT_CREATE_STARTED]: (state, action) => _extends$9({}, state, {
isLoading: true isLoading: true
}), }),
[COMMENT_CREATE_FAILED]: (state, action) => _extends$8({}, state, { [COMMENT_CREATE_FAILED]: (state, action) => _extends$9({}, state, {
isLoading: false isLoading: false
}), }),
@ -4818,14 +4831,14 @@ const commentReducer = handleActions({
newCommentIds.unshift(comment.comment_id); newCommentIds.unshift(comment.comment_id);
byId[claimId] = newCommentIds; byId[claimId] = newCommentIds;
return _extends$8({}, state, { return _extends$9({}, state, {
commentById, commentById,
byId, byId,
isLoading: false isLoading: false
}); });
}, },
[COMMENT_LIST_STARTED]: state => _extends$8({}, state, { isLoading: true }), [COMMENT_LIST_STARTED]: state => _extends$9({}, state, { isLoading: true }),
[COMMENT_LIST_COMPLETED]: (state, action) => { [COMMENT_LIST_COMPLETED]: (state, action) => {
const { comments, claimId, uri } = action.data; const { comments, claimId, uri } = action.data;
@ -4849,7 +4862,7 @@ const commentReducer = handleActions({
byId[claimId] = commentIds; byId[claimId] = commentIds;
commentsByUri[uri] = claimId; commentsByUri[uri] = claimId;
} }
return _extends$8({}, state, { return _extends$9({}, state, {
byId, byId,
commentById, commentById,
commentsByUri, commentsByUri,
@ -4857,10 +4870,10 @@ const commentReducer = handleActions({
}); });
}, },
[COMMENT_LIST_FAILED]: (state, action) => _extends$8({}, state, { [COMMENT_LIST_FAILED]: (state, action) => _extends$9({}, state, {
isLoading: false isLoading: false
}), }),
[COMMENT_ABANDON_STARTED]: (state, action) => _extends$8({}, state, { [COMMENT_ABANDON_STARTED]: (state, action) => _extends$9({}, state, {
isLoading: true isLoading: true
}), }),
[COMMENT_ABANDON_COMPLETED]: (state, action) => { [COMMENT_ABANDON_COMPLETED]: (state, action) => {
@ -4878,18 +4891,18 @@ const commentReducer = handleActions({
} }
delete commentById[comment_id]; delete commentById[comment_id];
return _extends$8({}, state, { return _extends$9({}, state, {
commentById, commentById,
byId, byId,
isLoading: false isLoading: false
}); });
}, },
// do nothing // do nothing
[COMMENT_ABANDON_FAILED]: (state, action) => _extends$8({}, state, { [COMMENT_ABANDON_FAILED]: (state, action) => _extends$9({}, state, {
isLoading: false isLoading: false
}), }),
// do nothing // do nothing
[COMMENT_UPDATE_STARTED]: (state, action) => _extends$8({}, state, { [COMMENT_UPDATE_STARTED]: (state, action) => _extends$9({}, state, {
isLoading: true isLoading: true
}), }),
// replace existing comment with comment returned here under its comment_id // replace existing comment with comment returned here under its comment_id
@ -4898,29 +4911,29 @@ const commentReducer = handleActions({
const commentById = Object.assign({}, state.commentById); const commentById = Object.assign({}, state.commentById);
commentById[comment.comment_id] = comment; commentById[comment.comment_id] = comment;
return _extends$8({}, state, { return _extends$9({}, state, {
commentById, commentById,
isLoading: false isLoading: false
}); });
}, },
// nothing can be done here // nothing can be done here
[COMMENT_UPDATE_FAILED]: (state, action) => _extends$8({}, state, { [COMMENT_UPDATE_FAILED]: (state, action) => _extends$9({}, state, {
isLoading: false isLoading: false
}), }),
// nothing can really be done here // nothing can really be done here
[COMMENT_HIDE_STARTED]: (state, action) => _extends$8({}, state, { [COMMENT_HIDE_STARTED]: (state, action) => _extends$9({}, state, {
isLoading: true isLoading: true
}), }),
[COMMENT_HIDE_COMPLETED]: (state, action) => _extends$8({}, state, { // todo: add HiddenComments state & create selectors [COMMENT_HIDE_COMPLETED]: (state, action) => _extends$9({}, state, { // todo: add HiddenComments state & create selectors
isLoading: false isLoading: false
}), }),
// nothing can be done here // nothing can be done here
[COMMENT_HIDE_FAILED]: (state, action) => _extends$8({}, state, { [COMMENT_HIDE_FAILED]: (state, action) => _extends$9({}, state, {
isLoading: false isLoading: false
}) })
}, defaultState$1); }, defaultState$1);
var _extends$9 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _extends$a = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
const reducers$1 = {}; const reducers$1 = {};
const defaultState$2 = { const defaultState$2 = {
@ -4929,9 +4942,9 @@ const defaultState$2 = {
reducers$1[SET_CONTENT_POSITION] = (state, action) => { reducers$1[SET_CONTENT_POSITION] = (state, action) => {
const { claimId, outpoint, position } = action.data; const { claimId, outpoint, position } = action.data;
return _extends$9({}, state, { return _extends$a({}, state, {
positions: _extends$9({}, state.positions, { positions: _extends$a({}, state.positions, {
[claimId]: _extends$9({}, state.positions[claimId], { [claimId]: _extends$a({}, state.positions[claimId], {
[outpoint]: position [outpoint]: position
}) })
}) })
@ -5098,7 +5111,7 @@ function fileInfoReducer(state = defaultState$3, action) {
return state; return state;
} }
var _extends$a = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _extends$b = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
const reducers$3 = {}; const reducers$3 = {};
const defaultState$4 = { const defaultState$4 = {
@ -5114,7 +5127,7 @@ reducers$3[PURCHASE_URI_STARTED] = (state, action) => {
newFailedPurchaseUris.splice(newFailedPurchaseUris.indexOf(uri), 1); newFailedPurchaseUris.splice(newFailedPurchaseUris.indexOf(uri), 1);
} }
return _extends$a({}, state, { return _extends$b({}, state, {
failedPurchaseUris: newFailedPurchaseUris, failedPurchaseUris: newFailedPurchaseUris,
purchaseUriErrorMessage: '' purchaseUriErrorMessage: ''
}); });
@ -5132,7 +5145,7 @@ reducers$3[PURCHASE_URI_COMPLETED] = (state, action) => {
newFailedPurchaseUris.splice(newFailedPurchaseUris.indexOf(uri), 1); newFailedPurchaseUris.splice(newFailedPurchaseUris.indexOf(uri), 1);
} }
return _extends$a({}, state, { return _extends$b({}, state, {
failedPurchaseUris: newFailedPurchaseUris, failedPurchaseUris: newFailedPurchaseUris,
purchasedUris: newPurchasedUris, purchasedUris: newPurchasedUris,
purchaseUriErrorMessage: '' purchaseUriErrorMessage: ''
@ -5147,7 +5160,7 @@ reducers$3[PURCHASE_URI_FAILED] = (state, action) => {
newFailedPurchaseUris.push(uri); newFailedPurchaseUris.push(uri);
} }
return _extends$a({}, state, { return _extends$b({}, state, {
failedPurchaseUris: newFailedPurchaseUris, failedPurchaseUris: newFailedPurchaseUris,
purchaseUriErrorMessage: error purchaseUriErrorMessage: error
}); });
@ -5160,7 +5173,7 @@ reducers$3[DELETE_PURCHASED_URI] = (state, action) => {
newPurchasedUris.splice(newPurchasedUris.indexOf(uri), 1); newPurchasedUris.splice(newPurchasedUris.indexOf(uri), 1);
} }
return _extends$a({}, state, { return _extends$b({}, state, {
purchasedUris: newPurchasedUris purchasedUris: newPurchasedUris
}); });
}; };
@ -5171,7 +5184,7 @@ function fileReducer(state = defaultState$4, action) {
return state; return state;
} }
var _extends$b = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _extends$c = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
const defaultState$5 = { const defaultState$5 = {
notifications: [], notifications: [],
@ -5186,7 +5199,7 @@ const notificationsReducer = handleActions({
const newToasts = state.toasts.slice(); const newToasts = state.toasts.slice();
newToasts.push(toast); newToasts.push(toast);
return _extends$b({}, state, { return _extends$c({}, state, {
toasts: newToasts toasts: newToasts
}); });
}, },
@ -5194,7 +5207,7 @@ const notificationsReducer = handleActions({
const newToasts = state.toasts.slice(); const newToasts = state.toasts.slice();
newToasts.shift(); newToasts.shift();
return _extends$b({}, state, { return _extends$c({}, state, {
toasts: newToasts toasts: newToasts
}); });
}, },
@ -5205,7 +5218,7 @@ const notificationsReducer = handleActions({
const newNotifications = state.notifications.slice(); const newNotifications = state.notifications.slice();
newNotifications.push(notification); newNotifications.push(notification);
return _extends$b({}, state, { return _extends$c({}, state, {
notifications: newNotifications notifications: newNotifications
}); });
}, },
@ -5216,7 +5229,7 @@ const notificationsReducer = handleActions({
notifications = notifications.map(pastNotification => pastNotification.id === notification.id ? notification : pastNotification); notifications = notifications.map(pastNotification => pastNotification.id === notification.id ? notification : pastNotification);
return _extends$b({}, state, { return _extends$c({}, state, {
notifications notifications
}); });
}, },
@ -5225,7 +5238,7 @@ const notificationsReducer = handleActions({
let newNotifications = state.notifications.slice(); let newNotifications = state.notifications.slice();
newNotifications = newNotifications.filter(notification => notification.id !== id); newNotifications = newNotifications.filter(notification => notification.id !== id);
return _extends$b({}, state, { return _extends$c({}, state, {
notifications: newNotifications notifications: newNotifications
}); });
}, },
@ -5236,7 +5249,7 @@ const notificationsReducer = handleActions({
const newErrors = state.errors.slice(); const newErrors = state.errors.slice();
newErrors.push(error); newErrors.push(error);
return _extends$b({}, state, { return _extends$c({}, state, {
errors: newErrors errors: newErrors
}); });
}, },
@ -5244,13 +5257,13 @@ const notificationsReducer = handleActions({
const newErrors = state.errors.slice(); const newErrors = state.errors.slice();
newErrors.shift(); newErrors.shift();
return _extends$b({}, state, { return _extends$c({}, state, {
errors: newErrors errors: newErrors
}); });
} }
}, defaultState$5); }, defaultState$5);
var _extends$c = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _extends$d = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties$3(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } function _objectWithoutProperties$3(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
@ -5287,17 +5300,17 @@ const defaultState$6 = {
const publishReducer = handleActions({ const publishReducer = handleActions({
[UPDATE_PUBLISH_FORM]: (state, action) => { [UPDATE_PUBLISH_FORM]: (state, action) => {
const { data } = action; const { data } = action;
return _extends$c({}, state, data); return _extends$d({}, state, data);
}, },
[CLEAR_PUBLISH]: () => _extends$c({}, defaultState$6), [CLEAR_PUBLISH]: () => _extends$d({}, defaultState$6),
[PUBLISH_START]: state => _extends$c({}, state, { [PUBLISH_START]: state => _extends$d({}, state, {
publishing: true, publishing: true,
publishSuccess: false publishSuccess: false
}), }),
[PUBLISH_FAIL]: state => _extends$c({}, state, { [PUBLISH_FAIL]: state => _extends$d({}, state, {
publishing: false publishing: false
}), }),
[PUBLISH_SUCCESS]: state => _extends$c({}, state, { [PUBLISH_SUCCESS]: state => _extends$d({}, state, {
publishing: false, publishing: false,
publishSuccess: true publishSuccess: true
}), }),
@ -5312,14 +5325,14 @@ const publishReducer = handleActions({
streamName: name streamName: name
}); });
return _extends$c({}, defaultState$6, publishData, { return _extends$d({}, defaultState$6, publishData, {
editingURI: uri, editingURI: uri,
uri: shortUri uri: shortUri
}); });
} }
}, defaultState$6); }, defaultState$6);
var _extends$d = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _extends$e = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
const defaultState$7 = { const defaultState$7 = {
isActive: false, // does the user have any typed text in the search input isActive: false, // does the user have any typed text in the search input
@ -5341,23 +5354,23 @@ const defaultState$7 = {
}; };
const searchReducer = handleActions({ const searchReducer = handleActions({
[SEARCH_START]: state => _extends$d({}, state, { [SEARCH_START]: state => _extends$e({}, state, {
searching: true searching: true
}), }),
[SEARCH_SUCCESS]: (state, action) => { [SEARCH_SUCCESS]: (state, action) => {
const { query, uris } = action.data; const { query, uris } = action.data;
return _extends$d({}, state, { return _extends$e({}, state, {
searching: false, searching: false,
urisByQuery: Object.assign({}, state.urisByQuery, { [query]: uris }) urisByQuery: Object.assign({}, state.urisByQuery, { [query]: uris })
}); });
}, },
[SEARCH_FAIL]: state => _extends$d({}, state, { [SEARCH_FAIL]: state => _extends$e({}, state, {
searching: false searching: false
}), }),
[RESOLVED_SEARCH_START]: state => _extends$d({}, state, { [RESOLVED_SEARCH_START]: state => _extends$e({}, state, {
searching: true searching: true
}), }),
[RESOLVED_SEARCH_SUCCESS]: (state, action) => { [RESOLVED_SEARCH_SUCCESS]: (state, action) => {
@ -5375,24 +5388,24 @@ const searchReducer = handleActions({
// the returned number of urls is less than the page size, so we're on the last page // the returned number of urls is less than the page size, so we're on the last page
resolvedResultsByQueryLastPageReached[query] = results.length < pageSize; resolvedResultsByQueryLastPageReached[query] = results.length < pageSize;
return _extends$d({}, state, { return _extends$e({}, state, {
searching: false, searching: false,
resolvedResultsByQuery, resolvedResultsByQuery,
resolvedResultsByQueryLastPageReached resolvedResultsByQueryLastPageReached
}); });
}, },
[RESOLVED_SEARCH_FAIL]: state => _extends$d({}, state, { [RESOLVED_SEARCH_FAIL]: state => _extends$e({}, state, {
searching: false searching: false
}), }),
[UPDATE_SEARCH_QUERY]: (state, action) => _extends$d({}, state, { [UPDATE_SEARCH_QUERY]: (state, action) => _extends$e({}, state, {
searchQuery: action.data.query, searchQuery: action.data.query,
isActive: true isActive: true
}), }),
[UPDATE_SEARCH_SUGGESTIONS]: (state, action) => _extends$d({}, state, { [UPDATE_SEARCH_SUGGESTIONS]: (state, action) => _extends$e({}, state, {
suggestions: _extends$d({}, state.suggestions, { suggestions: _extends$e({}, state.suggestions, {
[action.data.query]: action.data.suggestions [action.data.query]: action.data.suggestions
}) })
}), }),
@ -5400,30 +5413,30 @@ const searchReducer = handleActions({
// sets isActive to false so the uri will be populated correctly if the // sets isActive to false so the uri will be populated correctly if the
// user is on a file page. The search query will still be present on any // user is on a file page. The search query will still be present on any
// other page // other page
[DISMISS_NOTIFICATION]: state => _extends$d({}, state, { [DISMISS_NOTIFICATION]: state => _extends$e({}, state, {
isActive: false isActive: false
}), }),
[SEARCH_FOCUS]: state => _extends$d({}, state, { [SEARCH_FOCUS]: state => _extends$e({}, state, {
focused: true focused: true
}), }),
[SEARCH_BLUR]: state => _extends$d({}, state, { [SEARCH_BLUR]: state => _extends$e({}, state, {
focused: false focused: false
}), }),
[UPDATE_SEARCH_OPTIONS]: (state, action) => { [UPDATE_SEARCH_OPTIONS]: (state, action) => {
const { options: oldOptions } = state; const { options: oldOptions } = state;
const newOptions = action.data; const newOptions = action.data;
const options = _extends$d({}, oldOptions, newOptions); const options = _extends$e({}, oldOptions, newOptions);
return _extends$d({}, state, { return _extends$e({}, state, {
options options
}); });
} }
}, defaultState$7); }, defaultState$7);
var _extends$e = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _extends$f = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function getDefaultKnownTags() { function getDefaultKnownTags() {
return DEFAULT_FOLLOWED_TAGS.concat(DEFAULT_KNOWN_TAGS).reduce((tagsMap, tag) => _extends$e({}, tagsMap, { return DEFAULT_FOLLOWED_TAGS.concat(DEFAULT_KNOWN_TAGS).reduce((tagsMap, tag) => _extends$f({}, tagsMap, {
[tag]: { name: tag } [tag]: { name: tag }
}), {}); }), {});
} }
@ -5446,7 +5459,7 @@ const tagsReducer = handleActions({
newFollowedTags.push(name); newFollowedTags.push(name);
} }
return _extends$e({}, state, { return _extends$f({}, state, {
followedTags: newFollowedTags followedTags: newFollowedTags
}); });
}, },
@ -5455,10 +5468,10 @@ const tagsReducer = handleActions({
const { knownTags } = state; const { knownTags } = state;
const { name } = action.data; const { name } = action.data;
let newKnownTags = _extends$e({}, knownTags); let newKnownTags = _extends$f({}, knownTags);
newKnownTags[name] = { name }; newKnownTags[name] = { name };
return _extends$e({}, state, { return _extends$f({}, state, {
knownTags: newKnownTags knownTags: newKnownTags
}); });
}, },
@ -5467,24 +5480,24 @@ const tagsReducer = handleActions({
const { knownTags, followedTags } = state; const { knownTags, followedTags } = state;
const { name } = action.data; const { name } = action.data;
let newKnownTags = _extends$e({}, knownTags); let newKnownTags = _extends$f({}, knownTags);
delete newKnownTags[name]; delete newKnownTags[name];
const newFollowedTags = followedTags.filter(tag => tag !== name); const newFollowedTags = followedTags.filter(tag => tag !== name);
return _extends$e({}, state, { return _extends$f({}, state, {
knownTags: newKnownTags, knownTags: newKnownTags,
followedTags: newFollowedTags followedTags: newFollowedTags
}); });
}, },
[USER_STATE_POPULATE]: (state, action) => { [USER_STATE_POPULATE]: (state, action) => {
const { tags } = action.data; const { tags } = action.data;
return _extends$e({}, state, { return _extends$f({}, state, {
followedTags: tags && tags.length ? tags : DEFAULT_FOLLOWED_TAGS followedTags: tags && tags.length ? tags : DEFAULT_FOLLOWED_TAGS
}); });
} }
}, defaultState$8); }, defaultState$8);
var _extends$f = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _extends$g = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
const defaultState$9 = { const defaultState$9 = {
blockedChannels: [] blockedChannels: []
@ -5508,13 +5521,13 @@ const blockedReducer = handleActions({
}, },
[USER_STATE_POPULATE]: (state, action) => { [USER_STATE_POPULATE]: (state, action) => {
const { blocked } = action.data; const { blocked } = action.data;
return _extends$f({}, state, { return _extends$g({}, state, {
blockedChannels: blocked && blocked.length ? blocked : state.blockedChannels blockedChannels: blocked && blocked.length ? blocked : state.blockedChannels
}); });
} }
}, defaultState$9); }, defaultState$9);
var _extends$g = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _extends$h = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
const buildDraftTransaction = () => ({ const buildDraftTransaction = () => ({
amount: undefined, amount: undefined,
@ -5559,25 +5572,25 @@ const defaultState$a = {
}; };
const walletReducer = handleActions({ const walletReducer = handleActions({
[FETCH_TRANSACTIONS_STARTED]: state => _extends$g({}, state, { [FETCH_TRANSACTIONS_STARTED]: state => _extends$h({}, state, {
fetchingTransactions: true fetchingTransactions: true
}), }),
[FETCH_TRANSACTIONS_COMPLETED]: (state, action) => { [FETCH_TRANSACTIONS_COMPLETED]: (state, action) => {
const byId = _extends$g({}, state.transactions); const byId = _extends$h({}, state.transactions);
const { transactions } = action.data; const { transactions } = action.data;
transactions.forEach(transaction => { transactions.forEach(transaction => {
byId[transaction.txid] = transaction; byId[transaction.txid] = transaction;
}); });
return _extends$g({}, state, { return _extends$h({}, state, {
transactions: byId, transactions: byId,
fetchingTransactions: false fetchingTransactions: false
}); });
}, },
[FETCH_SUPPORTS_STARTED]: state => _extends$g({}, state, { [FETCH_SUPPORTS_STARTED]: state => _extends$h({}, state, {
fetchingSupports: true fetchingSupports: true
}), }),
@ -5590,7 +5603,7 @@ const walletReducer = handleActions({
byOutpoint[`${txid}:${nout}`] = transaction; byOutpoint[`${txid}:${nout}`] = transaction;
}); });
return _extends$g({}, state, { supports: byOutpoint, fetchingSupports: false }); return _extends$h({}, state, { supports: byOutpoint, fetchingSupports: false });
}, },
[ABANDON_SUPPORT_STARTED]: (state, action) => { [ABANDON_SUPPORT_STARTED]: (state, action) => {
@ -5599,7 +5612,7 @@ const walletReducer = handleActions({
currentlyAbandoning[outpoint] = true; currentlyAbandoning[outpoint] = true;
return _extends$g({}, state, { return _extends$h({}, state, {
abandoningSupportsByOutpoint: currentlyAbandoning abandoningSupportsByOutpoint: currentlyAbandoning
}); });
}, },
@ -5612,23 +5625,23 @@ const walletReducer = handleActions({
delete currentlyAbandoning[outpoint]; delete currentlyAbandoning[outpoint];
delete byOutpoint[outpoint]; delete byOutpoint[outpoint];
return _extends$g({}, state, { return _extends$h({}, state, {
supports: byOutpoint, supports: byOutpoint,
abandoningSupportsById: currentlyAbandoning abandoningSupportsById: currentlyAbandoning
}); });
}, },
[GET_NEW_ADDRESS_STARTED]: state => _extends$g({}, state, { [GET_NEW_ADDRESS_STARTED]: state => _extends$h({}, state, {
gettingNewAddress: true gettingNewAddress: true
}), }),
[GET_NEW_ADDRESS_COMPLETED]: (state, action) => { [GET_NEW_ADDRESS_COMPLETED]: (state, action) => {
const { address } = action.data; const { address } = action.data;
return _extends$g({}, state, { gettingNewAddress: false, receiveAddress: address }); return _extends$h({}, state, { gettingNewAddress: false, receiveAddress: address });
}, },
[UPDATE_BALANCE]: (state, action) => _extends$g({}, state, { [UPDATE_BALANCE]: (state, action) => _extends$h({}, state, {
totalBalance: action.data.totalBalance, totalBalance: action.data.totalBalance,
balance: action.data.balance, balance: action.data.balance,
reservedBalance: action.data.reservedBalance, reservedBalance: action.data.reservedBalance,
@ -5637,32 +5650,32 @@ const walletReducer = handleActions({
tipsBalance: action.data.tipsBalance tipsBalance: action.data.tipsBalance
}), }),
[CHECK_ADDRESS_IS_MINE_STARTED]: state => _extends$g({}, state, { [CHECK_ADDRESS_IS_MINE_STARTED]: state => _extends$h({}, state, {
checkingAddressOwnership: true checkingAddressOwnership: true
}), }),
[CHECK_ADDRESS_IS_MINE_COMPLETED]: state => _extends$g({}, state, { [CHECK_ADDRESS_IS_MINE_COMPLETED]: state => _extends$h({}, state, {
checkingAddressOwnership: false checkingAddressOwnership: false
}), }),
[SET_DRAFT_TRANSACTION_AMOUNT]: (state, action) => { [SET_DRAFT_TRANSACTION_AMOUNT]: (state, action) => {
const oldDraft = state.draftTransaction; const oldDraft = state.draftTransaction;
const newDraft = _extends$g({}, oldDraft, { amount: parseFloat(action.data.amount) }); const newDraft = _extends$h({}, oldDraft, { amount: parseFloat(action.data.amount) });
return _extends$g({}, state, { draftTransaction: newDraft }); return _extends$h({}, state, { draftTransaction: newDraft });
}, },
[SET_DRAFT_TRANSACTION_ADDRESS]: (state, action) => { [SET_DRAFT_TRANSACTION_ADDRESS]: (state, action) => {
const oldDraft = state.draftTransaction; const oldDraft = state.draftTransaction;
const newDraft = _extends$g({}, oldDraft, { address: action.data.address }); const newDraft = _extends$h({}, oldDraft, { address: action.data.address });
return _extends$g({}, state, { draftTransaction: newDraft }); return _extends$h({}, state, { draftTransaction: newDraft });
}, },
[SEND_TRANSACTION_STARTED]: state => { [SEND_TRANSACTION_STARTED]: state => {
const newDraftTransaction = _extends$g({}, state.draftTransaction, { sending: true }); const newDraftTransaction = _extends$h({}, state.draftTransaction, { sending: true });
return _extends$g({}, state, { draftTransaction: newDraftTransaction }); return _extends$h({}, state, { draftTransaction: newDraftTransaction });
}, },
[SEND_TRANSACTION_COMPLETED]: state => Object.assign({}, state, { [SEND_TRANSACTION_COMPLETED]: state => Object.assign({}, state, {
@ -5675,114 +5688,114 @@ const walletReducer = handleActions({
error: action.data.error error: action.data.error
}); });
return _extends$g({}, state, { draftTransaction: newDraftTransaction }); return _extends$h({}, state, { draftTransaction: newDraftTransaction });
}, },
[SUPPORT_TRANSACTION_STARTED]: state => _extends$g({}, state, { [SUPPORT_TRANSACTION_STARTED]: state => _extends$h({}, state, {
sendingSupport: true sendingSupport: true
}), }),
[SUPPORT_TRANSACTION_COMPLETED]: state => _extends$g({}, state, { [SUPPORT_TRANSACTION_COMPLETED]: state => _extends$h({}, state, {
sendingSupport: false sendingSupport: false
}), }),
[SUPPORT_TRANSACTION_FAILED]: (state, action) => _extends$g({}, state, { [SUPPORT_TRANSACTION_FAILED]: (state, action) => _extends$h({}, state, {
error: action.data.error, error: action.data.error,
sendingSupport: false sendingSupport: false
}), }),
[CLEAR_SUPPORT_TRANSACTION]: state => _extends$g({}, state, { [CLEAR_SUPPORT_TRANSACTION]: state => _extends$h({}, state, {
sendingSupport: false sendingSupport: false
}), }),
[WALLET_STATUS_COMPLETED]: (state, action) => _extends$g({}, state, { [WALLET_STATUS_COMPLETED]: (state, action) => _extends$h({}, state, {
walletIsEncrypted: action.result walletIsEncrypted: action.result
}), }),
[WALLET_ENCRYPT_START]: state => _extends$g({}, state, { [WALLET_ENCRYPT_START]: state => _extends$h({}, state, {
walletEncryptPending: true, walletEncryptPending: true,
walletEncryptSucceded: null, walletEncryptSucceded: null,
walletEncryptResult: null walletEncryptResult: null
}), }),
[WALLET_ENCRYPT_COMPLETED]: (state, action) => _extends$g({}, state, { [WALLET_ENCRYPT_COMPLETED]: (state, action) => _extends$h({}, state, {
walletEncryptPending: false, walletEncryptPending: false,
walletEncryptSucceded: true, walletEncryptSucceded: true,
walletEncryptResult: action.result walletEncryptResult: action.result
}), }),
[WALLET_ENCRYPT_FAILED]: (state, action) => _extends$g({}, state, { [WALLET_ENCRYPT_FAILED]: (state, action) => _extends$h({}, state, {
walletEncryptPending: false, walletEncryptPending: false,
walletEncryptSucceded: false, walletEncryptSucceded: false,
walletEncryptResult: action.result walletEncryptResult: action.result
}), }),
[WALLET_DECRYPT_START]: state => _extends$g({}, state, { [WALLET_DECRYPT_START]: state => _extends$h({}, state, {
walletDecryptPending: true, walletDecryptPending: true,
walletDecryptSucceded: null, walletDecryptSucceded: null,
walletDecryptResult: null walletDecryptResult: null
}), }),
[WALLET_DECRYPT_COMPLETED]: (state, action) => _extends$g({}, state, { [WALLET_DECRYPT_COMPLETED]: (state, action) => _extends$h({}, state, {
walletDecryptPending: false, walletDecryptPending: false,
walletDecryptSucceded: true, walletDecryptSucceded: true,
walletDecryptResult: action.result walletDecryptResult: action.result
}), }),
[WALLET_DECRYPT_FAILED]: (state, action) => _extends$g({}, state, { [WALLET_DECRYPT_FAILED]: (state, action) => _extends$h({}, state, {
walletDecryptPending: false, walletDecryptPending: false,
walletDecryptSucceded: false, walletDecryptSucceded: false,
walletDecryptResult: action.result walletDecryptResult: action.result
}), }),
[WALLET_UNLOCK_START]: state => _extends$g({}, state, { [WALLET_UNLOCK_START]: state => _extends$h({}, state, {
walletUnlockPending: true, walletUnlockPending: true,
walletUnlockSucceded: null, walletUnlockSucceded: null,
walletUnlockResult: null walletUnlockResult: null
}), }),
[WALLET_UNLOCK_COMPLETED]: (state, action) => _extends$g({}, state, { [WALLET_UNLOCK_COMPLETED]: (state, action) => _extends$h({}, state, {
walletUnlockPending: false, walletUnlockPending: false,
walletUnlockSucceded: true, walletUnlockSucceded: true,
walletUnlockResult: action.result walletUnlockResult: action.result
}), }),
[WALLET_UNLOCK_FAILED]: (state, action) => _extends$g({}, state, { [WALLET_UNLOCK_FAILED]: (state, action) => _extends$h({}, state, {
walletUnlockPending: false, walletUnlockPending: false,
walletUnlockSucceded: false, walletUnlockSucceded: false,
walletUnlockResult: action.result walletUnlockResult: action.result
}), }),
[WALLET_LOCK_START]: state => _extends$g({}, state, { [WALLET_LOCK_START]: state => _extends$h({}, state, {
walletLockPending: false, walletLockPending: false,
walletLockSucceded: null, walletLockSucceded: null,
walletLockResult: null walletLockResult: null
}), }),
[WALLET_LOCK_COMPLETED]: (state, action) => _extends$g({}, state, { [WALLET_LOCK_COMPLETED]: (state, action) => _extends$h({}, state, {
walletLockPending: false, walletLockPending: false,
walletLockSucceded: true, walletLockSucceded: true,
walletLockResult: action.result walletLockResult: action.result
}), }),
[WALLET_LOCK_FAILED]: (state, action) => _extends$g({}, state, { [WALLET_LOCK_FAILED]: (state, action) => _extends$h({}, state, {
walletLockPending: false, walletLockPending: false,
walletLockSucceded: false, walletLockSucceded: false,
walletLockResult: action.result walletLockResult: action.result
}), }),
[SET_TRANSACTION_LIST_FILTER]: (state, action) => _extends$g({}, state, { [SET_TRANSACTION_LIST_FILTER]: (state, action) => _extends$h({}, state, {
transactionListFilter: action.data transactionListFilter: action.data
}), }),
[UPDATE_CURRENT_HEIGHT]: (state, action) => _extends$g({}, state, { [UPDATE_CURRENT_HEIGHT]: (state, action) => _extends$h({}, state, {
latestBlock: action.data latestBlock: action.data
}), }),
[WALLET_RESTART]: state => _extends$g({}, state, { [WALLET_RESTART]: state => _extends$h({}, state, {
walletReconnecting: true walletReconnecting: true
}), }),
[WALLET_RESTART_COMPLETED]: state => _extends$g({}, state, { [WALLET_RESTART_COMPLETED]: state => _extends$h({}, state, {
walletReconnecting: false walletReconnecting: false
}) })
}, defaultState$a); }, defaultState$a);
@ -5800,14 +5813,14 @@ const makeSelectContentPositionForUri = uri => reselect.createSelector(selectSta
return state.positions[id] ? state.positions[id][outpoint] : null; return state.positions[id] ? state.positions[id][outpoint] : null;
}); });
var _extends$h = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _extends$i = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
const selectState$7 = state => state.notifications || {}; const selectState$7 = state => state.notifications || {};
const selectToast = reselect.createSelector(selectState$7, state => { const selectToast = reselect.createSelector(selectState$7, state => {
if (state.toasts.length) { if (state.toasts.length) {
const { id, params } = state.toasts[0]; const { id, params } = state.toasts[0];
return _extends$h({ return _extends$i({
id id
}, params); }, params);
} }

View file

@ -33,6 +33,7 @@ declare type GenericClaim = {
type: 'claim' | 'update' | 'support', type: 'claim' | 'update' | 'support',
value_type: 'stream' | 'channel', value_type: 'stream' | 'channel',
signing_channel?: ChannelClaim, signing_channel?: ChannelClaim,
repost_channel_url?: string,
meta: { meta: {
activation_height: number, activation_height: number,
claims_in_channel?: number, claims_in_channel?: number,

1
flow-typed/Claim.js vendored
View file

@ -33,6 +33,7 @@ declare type GenericClaim = {
type: 'claim' | 'update' | 'support', type: 'claim' | 'update' | 'support',
value_type: 'stream' | 'channel', value_type: 'stream' | 'channel',
signing_channel?: ChannelClaim, signing_channel?: ChannelClaim,
repost_channel_url?: string,
meta: { meta: {
activation_height: number, activation_height: number,
claims_in_channel?: number, claims_in_channel?: number,

View file

@ -114,7 +114,7 @@ export const makeSelectClaimForUri = (uri: string) =>
valid = true; valid = true;
} catch (e) {} } catch (e) {}
if (valid) { if (valid && byUri) {
const claimId = isChannel ? channelClaimId : streamClaimId; const claimId = isChannel ? channelClaimId : streamClaimId;
const pendingClaim = pendingById[claimId]; const pendingClaim = pendingById[claimId];
@ -122,7 +122,21 @@ export const makeSelectClaimForUri = (uri: string) =>
return pendingClaim; return pendingClaim;
} }
return byUri && byUri[normalizeURI(uri)]; const claim = byUri[normalizeURI(uri)];
if (claim === undefined || claim === null) {
// Make sure to return the claim as is so apps can check if it's been resolved before (null) or still needs to be resolved (undefined)
return claim;
}
const repostedClaim = claim.reposted_claim;
if (repostedClaim) {
return {
...repostedClaim,
repost_channel_url: claim.canonical_url,
};
} else {
return claim;
}
} }
} }
); );