handle repost claims

This commit is contained in:
Sean Yesmunt 2020-01-30 17:13:40 -05:00
parent b5bbece10d
commit f77bee9cf1
4 changed files with 152 additions and 123 deletions

255
dist/bundle.es.js vendored
View file

@ -1934,7 +1934,7 @@ function concatClaims(claimList = [], concatClaimList = []) {
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 selectClaimsById = reselect.createSelector(selectState$2, state => state.byId || {});
@ -2003,7 +2003,7 @@ const makeSelectClaimForUri = uri => reselect.createSelector(selectClaimsByUri,
valid = true;
} catch (e) {}
if (valid) {
if (valid && byUri) {
const claimId = isChannel ? channelClaimId : streamClaimId;
const pendingClaim = pendingById[claimId];
@ -2011,7 +2011,20 @@ const makeSelectClaimForUri = uri => reselect.createSelector(selectClaimsByUri,
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) {
return (dispatch, getState) => {
@ -2807,7 +2820,7 @@ function doResolveUris(uris, returnCachedClaims = false) {
// https://github.com/facebook/flow/issues/2221
if (uriResolveInfo) {
if (uriResolveInfo.error) {
resolveInfo[uri] = _extends$4({}, fallbackResolveInfo);
resolveInfo[uri] = _extends$5({}, fallbackResolveInfo);
} else {
let result = {};
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; }
@ -3540,7 +3553,7 @@ const selectPublishFormValues = reselect.createSelector(selectState$5, selectIsS
} else {
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]);
@ -3595,7 +3608,7 @@ const selectTakeOverAmount = reselect.createSelector(selectState$5, selectMyClai
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 => {
dispatch({
@ -3633,7 +3646,7 @@ const doClearPublish = () => dispatch => {
const doUpdatePublishForm = publishFormValue => dispatch => dispatch({
type: UPDATE_PUBLISH_FORM,
data: _extends$6({}, publishFormValue)
data: _extends$7({}, publishFormValue)
});
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 defaultState = {
@ -4484,7 +4497,7 @@ reducers[RESOLVE_URIS_STARTED] = (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, {
@ -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,
createChannelError: null
});
@ -4745,7 +4758,7 @@ reducers[CLAIM_SEARCH_COMPLETED] = (state, action) => {
delete fetchingClaimSearchByQuery[query];
return Object.assign({}, state, _extends$7({}, handleClaimAction(state, action), {
return Object.assign({}, state, _extends$8({}, handleClaimAction(state, action), {
claimSearchByQuery,
claimSearchByQueryLastPageReached,
fetchingClaimSearchByQuery
@ -4785,7 +4798,7 @@ const handleActions = (actionMap, defaultState) => (state = defaultState, action
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 = {
commentById: {}, // commentId -> Comment
@ -4796,11 +4809,11 @@ const defaultState$1 = {
};
const commentReducer = handleActions({
[COMMENT_CREATE_STARTED]: (state, action) => _extends$8({}, state, {
[COMMENT_CREATE_STARTED]: (state, action) => _extends$9({}, state, {
isLoading: true
}),
[COMMENT_CREATE_FAILED]: (state, action) => _extends$8({}, state, {
[COMMENT_CREATE_FAILED]: (state, action) => _extends$9({}, state, {
isLoading: false
}),
@ -4818,14 +4831,14 @@ const commentReducer = handleActions({
newCommentIds.unshift(comment.comment_id);
byId[claimId] = newCommentIds;
return _extends$8({}, state, {
return _extends$9({}, state, {
commentById,
byId,
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) => {
const { comments, claimId, uri } = action.data;
@ -4849,7 +4862,7 @@ const commentReducer = handleActions({
byId[claimId] = commentIds;
commentsByUri[uri] = claimId;
}
return _extends$8({}, state, {
return _extends$9({}, state, {
byId,
commentById,
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
}),
[COMMENT_ABANDON_STARTED]: (state, action) => _extends$8({}, state, {
[COMMENT_ABANDON_STARTED]: (state, action) => _extends$9({}, state, {
isLoading: true
}),
[COMMENT_ABANDON_COMPLETED]: (state, action) => {
@ -4878,18 +4891,18 @@ const commentReducer = handleActions({
}
delete commentById[comment_id];
return _extends$8({}, state, {
return _extends$9({}, state, {
commentById,
byId,
isLoading: false
});
},
// do nothing
[COMMENT_ABANDON_FAILED]: (state, action) => _extends$8({}, state, {
[COMMENT_ABANDON_FAILED]: (state, action) => _extends$9({}, state, {
isLoading: false
}),
// do nothing
[COMMENT_UPDATE_STARTED]: (state, action) => _extends$8({}, state, {
[COMMENT_UPDATE_STARTED]: (state, action) => _extends$9({}, state, {
isLoading: true
}),
// replace existing comment with comment returned here under its comment_id
@ -4898,29 +4911,29 @@ const commentReducer = handleActions({
const commentById = Object.assign({}, state.commentById);
commentById[comment.comment_id] = comment;
return _extends$8({}, state, {
return _extends$9({}, state, {
commentById,
isLoading: false
});
},
// nothing can be done here
[COMMENT_UPDATE_FAILED]: (state, action) => _extends$8({}, state, {
[COMMENT_UPDATE_FAILED]: (state, action) => _extends$9({}, state, {
isLoading: false
}),
// nothing can really be done here
[COMMENT_HIDE_STARTED]: (state, action) => _extends$8({}, state, {
[COMMENT_HIDE_STARTED]: (state, action) => _extends$9({}, state, {
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
}),
// nothing can be done here
[COMMENT_HIDE_FAILED]: (state, action) => _extends$8({}, state, {
[COMMENT_HIDE_FAILED]: (state, action) => _extends$9({}, state, {
isLoading: false
})
}, 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 defaultState$2 = {
@ -4929,9 +4942,9 @@ const defaultState$2 = {
reducers$1[SET_CONTENT_POSITION] = (state, action) => {
const { claimId, outpoint, position } = action.data;
return _extends$9({}, state, {
positions: _extends$9({}, state.positions, {
[claimId]: _extends$9({}, state.positions[claimId], {
return _extends$a({}, state, {
positions: _extends$a({}, state.positions, {
[claimId]: _extends$a({}, state.positions[claimId], {
[outpoint]: position
})
})
@ -5098,7 +5111,7 @@ function fileInfoReducer(state = defaultState$3, action) {
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 defaultState$4 = {
@ -5114,7 +5127,7 @@ reducers$3[PURCHASE_URI_STARTED] = (state, action) => {
newFailedPurchaseUris.splice(newFailedPurchaseUris.indexOf(uri), 1);
}
return _extends$a({}, state, {
return _extends$b({}, state, {
failedPurchaseUris: newFailedPurchaseUris,
purchaseUriErrorMessage: ''
});
@ -5132,7 +5145,7 @@ reducers$3[PURCHASE_URI_COMPLETED] = (state, action) => {
newFailedPurchaseUris.splice(newFailedPurchaseUris.indexOf(uri), 1);
}
return _extends$a({}, state, {
return _extends$b({}, state, {
failedPurchaseUris: newFailedPurchaseUris,
purchasedUris: newPurchasedUris,
purchaseUriErrorMessage: ''
@ -5147,7 +5160,7 @@ reducers$3[PURCHASE_URI_FAILED] = (state, action) => {
newFailedPurchaseUris.push(uri);
}
return _extends$a({}, state, {
return _extends$b({}, state, {
failedPurchaseUris: newFailedPurchaseUris,
purchaseUriErrorMessage: error
});
@ -5160,7 +5173,7 @@ reducers$3[DELETE_PURCHASED_URI] = (state, action) => {
newPurchasedUris.splice(newPurchasedUris.indexOf(uri), 1);
}
return _extends$a({}, state, {
return _extends$b({}, state, {
purchasedUris: newPurchasedUris
});
};
@ -5171,7 +5184,7 @@ function fileReducer(state = defaultState$4, action) {
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 = {
notifications: [],
@ -5186,7 +5199,7 @@ const notificationsReducer = handleActions({
const newToasts = state.toasts.slice();
newToasts.push(toast);
return _extends$b({}, state, {
return _extends$c({}, state, {
toasts: newToasts
});
},
@ -5194,7 +5207,7 @@ const notificationsReducer = handleActions({
const newToasts = state.toasts.slice();
newToasts.shift();
return _extends$b({}, state, {
return _extends$c({}, state, {
toasts: newToasts
});
},
@ -5205,7 +5218,7 @@ const notificationsReducer = handleActions({
const newNotifications = state.notifications.slice();
newNotifications.push(notification);
return _extends$b({}, state, {
return _extends$c({}, state, {
notifications: newNotifications
});
},
@ -5216,7 +5229,7 @@ const notificationsReducer = handleActions({
notifications = notifications.map(pastNotification => pastNotification.id === notification.id ? notification : pastNotification);
return _extends$b({}, state, {
return _extends$c({}, state, {
notifications
});
},
@ -5225,7 +5238,7 @@ const notificationsReducer = handleActions({
let newNotifications = state.notifications.slice();
newNotifications = newNotifications.filter(notification => notification.id !== id);
return _extends$b({}, state, {
return _extends$c({}, state, {
notifications: newNotifications
});
},
@ -5236,7 +5249,7 @@ const notificationsReducer = handleActions({
const newErrors = state.errors.slice();
newErrors.push(error);
return _extends$b({}, state, {
return _extends$c({}, state, {
errors: newErrors
});
},
@ -5244,13 +5257,13 @@ const notificationsReducer = handleActions({
const newErrors = state.errors.slice();
newErrors.shift();
return _extends$b({}, state, {
return _extends$c({}, state, {
errors: newErrors
});
}
}, 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; }
@ -5287,17 +5300,17 @@ const defaultState$6 = {
const publishReducer = handleActions({
[UPDATE_PUBLISH_FORM]: (state, action) => {
const { data } = action;
return _extends$c({}, state, data);
return _extends$d({}, state, data);
},
[CLEAR_PUBLISH]: () => _extends$c({}, defaultState$6),
[PUBLISH_START]: state => _extends$c({}, state, {
[CLEAR_PUBLISH]: () => _extends$d({}, defaultState$6),
[PUBLISH_START]: state => _extends$d({}, state, {
publishing: true,
publishSuccess: false
}),
[PUBLISH_FAIL]: state => _extends$c({}, state, {
[PUBLISH_FAIL]: state => _extends$d({}, state, {
publishing: false
}),
[PUBLISH_SUCCESS]: state => _extends$c({}, state, {
[PUBLISH_SUCCESS]: state => _extends$d({}, state, {
publishing: false,
publishSuccess: true
}),
@ -5312,14 +5325,14 @@ const publishReducer = handleActions({
streamName: name
});
return _extends$c({}, defaultState$6, publishData, {
return _extends$d({}, defaultState$6, publishData, {
editingURI: uri,
uri: shortUri
});
}
}, 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 = {
isActive: false, // does the user have any typed text in the search input
@ -5341,23 +5354,23 @@ const defaultState$7 = {
};
const searchReducer = handleActions({
[SEARCH_START]: state => _extends$d({}, state, {
[SEARCH_START]: state => _extends$e({}, state, {
searching: true
}),
[SEARCH_SUCCESS]: (state, action) => {
const { query, uris } = action.data;
return _extends$d({}, state, {
return _extends$e({}, state, {
searching: false,
urisByQuery: Object.assign({}, state.urisByQuery, { [query]: uris })
});
},
[SEARCH_FAIL]: state => _extends$d({}, state, {
[SEARCH_FAIL]: state => _extends$e({}, state, {
searching: false
}),
[RESOLVED_SEARCH_START]: state => _extends$d({}, state, {
[RESOLVED_SEARCH_START]: state => _extends$e({}, state, {
searching: true
}),
[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
resolvedResultsByQueryLastPageReached[query] = results.length < pageSize;
return _extends$d({}, state, {
return _extends$e({}, state, {
searching: false,
resolvedResultsByQuery,
resolvedResultsByQueryLastPageReached
});
},
[RESOLVED_SEARCH_FAIL]: state => _extends$d({}, state, {
[RESOLVED_SEARCH_FAIL]: state => _extends$e({}, state, {
searching: false
}),
[UPDATE_SEARCH_QUERY]: (state, action) => _extends$d({}, state, {
[UPDATE_SEARCH_QUERY]: (state, action) => _extends$e({}, state, {
searchQuery: action.data.query,
isActive: true
}),
[UPDATE_SEARCH_SUGGESTIONS]: (state, action) => _extends$d({}, state, {
suggestions: _extends$d({}, state.suggestions, {
[UPDATE_SEARCH_SUGGESTIONS]: (state, action) => _extends$e({}, state, {
suggestions: _extends$e({}, state.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
// user is on a file page. The search query will still be present on any
// other page
[DISMISS_NOTIFICATION]: state => _extends$d({}, state, {
[DISMISS_NOTIFICATION]: state => _extends$e({}, state, {
isActive: false
}),
[SEARCH_FOCUS]: state => _extends$d({}, state, {
[SEARCH_FOCUS]: state => _extends$e({}, state, {
focused: true
}),
[SEARCH_BLUR]: state => _extends$d({}, state, {
[SEARCH_BLUR]: state => _extends$e({}, state, {
focused: false
}),
[UPDATE_SEARCH_OPTIONS]: (state, action) => {
const { options: oldOptions } = state;
const newOptions = action.data;
const options = _extends$d({}, oldOptions, newOptions);
return _extends$d({}, state, {
const options = _extends$e({}, oldOptions, newOptions);
return _extends$e({}, state, {
options
});
}
}, 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() {
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 }
}), {});
}
@ -5446,7 +5459,7 @@ const tagsReducer = handleActions({
newFollowedTags.push(name);
}
return _extends$e({}, state, {
return _extends$f({}, state, {
followedTags: newFollowedTags
});
},
@ -5455,10 +5468,10 @@ const tagsReducer = handleActions({
const { knownTags } = state;
const { name } = action.data;
let newKnownTags = _extends$e({}, knownTags);
let newKnownTags = _extends$f({}, knownTags);
newKnownTags[name] = { name };
return _extends$e({}, state, {
return _extends$f({}, state, {
knownTags: newKnownTags
});
},
@ -5467,24 +5480,24 @@ const tagsReducer = handleActions({
const { knownTags, followedTags } = state;
const { name } = action.data;
let newKnownTags = _extends$e({}, knownTags);
let newKnownTags = _extends$f({}, knownTags);
delete newKnownTags[name];
const newFollowedTags = followedTags.filter(tag => tag !== name);
return _extends$e({}, state, {
return _extends$f({}, state, {
knownTags: newKnownTags,
followedTags: newFollowedTags
});
},
[USER_STATE_POPULATE]: (state, action) => {
const { tags } = action.data;
return _extends$e({}, state, {
return _extends$f({}, state, {
followedTags: tags && tags.length ? tags : DEFAULT_FOLLOWED_TAGS
});
}
}, 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 = {
blockedChannels: []
@ -5508,13 +5521,13 @@ const blockedReducer = handleActions({
},
[USER_STATE_POPULATE]: (state, action) => {
const { blocked } = action.data;
return _extends$f({}, state, {
return _extends$g({}, state, {
blockedChannels: blocked && blocked.length ? blocked : state.blockedChannels
});
}
}, 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 = () => ({
amount: undefined,
@ -5559,25 +5572,25 @@ const defaultState$a = {
};
const walletReducer = handleActions({
[FETCH_TRANSACTIONS_STARTED]: state => _extends$g({}, state, {
[FETCH_TRANSACTIONS_STARTED]: state => _extends$h({}, state, {
fetchingTransactions: true
}),
[FETCH_TRANSACTIONS_COMPLETED]: (state, action) => {
const byId = _extends$g({}, state.transactions);
const byId = _extends$h({}, state.transactions);
const { transactions } = action.data;
transactions.forEach(transaction => {
byId[transaction.txid] = transaction;
});
return _extends$g({}, state, {
return _extends$h({}, state, {
transactions: byId,
fetchingTransactions: false
});
},
[FETCH_SUPPORTS_STARTED]: state => _extends$g({}, state, {
[FETCH_SUPPORTS_STARTED]: state => _extends$h({}, state, {
fetchingSupports: true
}),
@ -5590,7 +5603,7 @@ const walletReducer = handleActions({
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) => {
@ -5599,7 +5612,7 @@ const walletReducer = handleActions({
currentlyAbandoning[outpoint] = true;
return _extends$g({}, state, {
return _extends$h({}, state, {
abandoningSupportsByOutpoint: currentlyAbandoning
});
},
@ -5612,23 +5625,23 @@ const walletReducer = handleActions({
delete currentlyAbandoning[outpoint];
delete byOutpoint[outpoint];
return _extends$g({}, state, {
return _extends$h({}, state, {
supports: byOutpoint,
abandoningSupportsById: currentlyAbandoning
});
},
[GET_NEW_ADDRESS_STARTED]: state => _extends$g({}, state, {
[GET_NEW_ADDRESS_STARTED]: state => _extends$h({}, state, {
gettingNewAddress: true
}),
[GET_NEW_ADDRESS_COMPLETED]: (state, action) => {
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,
balance: action.data.balance,
reservedBalance: action.data.reservedBalance,
@ -5637,32 +5650,32 @@ const walletReducer = handleActions({
tipsBalance: action.data.tipsBalance
}),
[CHECK_ADDRESS_IS_MINE_STARTED]: state => _extends$g({}, state, {
[CHECK_ADDRESS_IS_MINE_STARTED]: state => _extends$h({}, state, {
checkingAddressOwnership: true
}),
[CHECK_ADDRESS_IS_MINE_COMPLETED]: state => _extends$g({}, state, {
[CHECK_ADDRESS_IS_MINE_COMPLETED]: state => _extends$h({}, state, {
checkingAddressOwnership: false
}),
[SET_DRAFT_TRANSACTION_AMOUNT]: (state, action) => {
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) => {
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 => {
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, {
@ -5675,114 +5688,114 @@ const walletReducer = handleActions({
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
}),
[SUPPORT_TRANSACTION_COMPLETED]: state => _extends$g({}, state, {
[SUPPORT_TRANSACTION_COMPLETED]: state => _extends$h({}, state, {
sendingSupport: false
}),
[SUPPORT_TRANSACTION_FAILED]: (state, action) => _extends$g({}, state, {
[SUPPORT_TRANSACTION_FAILED]: (state, action) => _extends$h({}, state, {
error: action.data.error,
sendingSupport: false
}),
[CLEAR_SUPPORT_TRANSACTION]: state => _extends$g({}, state, {
[CLEAR_SUPPORT_TRANSACTION]: state => _extends$h({}, state, {
sendingSupport: false
}),
[WALLET_STATUS_COMPLETED]: (state, action) => _extends$g({}, state, {
[WALLET_STATUS_COMPLETED]: (state, action) => _extends$h({}, state, {
walletIsEncrypted: action.result
}),
[WALLET_ENCRYPT_START]: state => _extends$g({}, state, {
[WALLET_ENCRYPT_START]: state => _extends$h({}, state, {
walletEncryptPending: true,
walletEncryptSucceded: null,
walletEncryptResult: null
}),
[WALLET_ENCRYPT_COMPLETED]: (state, action) => _extends$g({}, state, {
[WALLET_ENCRYPT_COMPLETED]: (state, action) => _extends$h({}, state, {
walletEncryptPending: false,
walletEncryptSucceded: true,
walletEncryptResult: action.result
}),
[WALLET_ENCRYPT_FAILED]: (state, action) => _extends$g({}, state, {
[WALLET_ENCRYPT_FAILED]: (state, action) => _extends$h({}, state, {
walletEncryptPending: false,
walletEncryptSucceded: false,
walletEncryptResult: action.result
}),
[WALLET_DECRYPT_START]: state => _extends$g({}, state, {
[WALLET_DECRYPT_START]: state => _extends$h({}, state, {
walletDecryptPending: true,
walletDecryptSucceded: null,
walletDecryptResult: null
}),
[WALLET_DECRYPT_COMPLETED]: (state, action) => _extends$g({}, state, {
[WALLET_DECRYPT_COMPLETED]: (state, action) => _extends$h({}, state, {
walletDecryptPending: false,
walletDecryptSucceded: true,
walletDecryptResult: action.result
}),
[WALLET_DECRYPT_FAILED]: (state, action) => _extends$g({}, state, {
[WALLET_DECRYPT_FAILED]: (state, action) => _extends$h({}, state, {
walletDecryptPending: false,
walletDecryptSucceded: false,
walletDecryptResult: action.result
}),
[WALLET_UNLOCK_START]: state => _extends$g({}, state, {
[WALLET_UNLOCK_START]: state => _extends$h({}, state, {
walletUnlockPending: true,
walletUnlockSucceded: null,
walletUnlockResult: null
}),
[WALLET_UNLOCK_COMPLETED]: (state, action) => _extends$g({}, state, {
[WALLET_UNLOCK_COMPLETED]: (state, action) => _extends$h({}, state, {
walletUnlockPending: false,
walletUnlockSucceded: true,
walletUnlockResult: action.result
}),
[WALLET_UNLOCK_FAILED]: (state, action) => _extends$g({}, state, {
[WALLET_UNLOCK_FAILED]: (state, action) => _extends$h({}, state, {
walletUnlockPending: false,
walletUnlockSucceded: false,
walletUnlockResult: action.result
}),
[WALLET_LOCK_START]: state => _extends$g({}, state, {
[WALLET_LOCK_START]: state => _extends$h({}, state, {
walletLockPending: false,
walletLockSucceded: null,
walletLockResult: null
}),
[WALLET_LOCK_COMPLETED]: (state, action) => _extends$g({}, state, {
[WALLET_LOCK_COMPLETED]: (state, action) => _extends$h({}, state, {
walletLockPending: false,
walletLockSucceded: true,
walletLockResult: action.result
}),
[WALLET_LOCK_FAILED]: (state, action) => _extends$g({}, state, {
[WALLET_LOCK_FAILED]: (state, action) => _extends$h({}, state, {
walletLockPending: false,
walletLockSucceded: false,
walletLockResult: action.result
}),
[SET_TRANSACTION_LIST_FILTER]: (state, action) => _extends$g({}, state, {
[SET_TRANSACTION_LIST_FILTER]: (state, action) => _extends$h({}, state, {
transactionListFilter: action.data
}),
[UPDATE_CURRENT_HEIGHT]: (state, action) => _extends$g({}, state, {
[UPDATE_CURRENT_HEIGHT]: (state, action) => _extends$h({}, state, {
latestBlock: action.data
}),
[WALLET_RESTART]: state => _extends$g({}, state, {
[WALLET_RESTART]: state => _extends$h({}, state, {
walletReconnecting: true
}),
[WALLET_RESTART_COMPLETED]: state => _extends$g({}, state, {
[WALLET_RESTART_COMPLETED]: state => _extends$h({}, state, {
walletReconnecting: false
})
}, defaultState$a);
@ -5800,14 +5813,14 @@ const makeSelectContentPositionForUri = uri => reselect.createSelector(selectSta
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 selectToast = reselect.createSelector(selectState$7, state => {
if (state.toasts.length) {
const { id, params } = state.toasts[0];
return _extends$h({
return _extends$i({
id
}, params);
}

View file

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

1
flow-typed/Claim.js vendored
View file

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

View file

@ -114,7 +114,7 @@ export const makeSelectClaimForUri = (uri: string) =>
valid = true;
} catch (e) {}
if (valid) {
if (valid && byUri) {
const claimId = isChannel ? channelClaimId : streamClaimId;
const pendingClaim = pendingById[claimId];
@ -122,7 +122,21 @@ export const makeSelectClaimForUri = (uri: string) =>
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;
}
}
}
);