Cleanup
This commit is contained in:
parent
c30a8ec66c
commit
fd0d097c91
4 changed files with 25 additions and 22 deletions
31
dist/bundle.es.js
vendored
31
dist/bundle.es.js
vendored
|
@ -1246,6 +1246,18 @@ function buildURI(UrlObj, includeProto = true, protoDefault = 'lbry://') {
|
||||||
deprecatedParts = _objectWithoutProperties(UrlObj, ['streamName', 'streamClaimId', 'channelName', 'channelClaimId', 'primaryClaimSequence', 'primaryBidPosition', 'secondaryClaimSequence', 'secondaryBidPosition']);
|
deprecatedParts = _objectWithoutProperties(UrlObj, ['streamName', 'streamClaimId', 'channelName', 'channelClaimId', 'primaryClaimSequence', 'primaryBidPosition', 'secondaryClaimSequence', 'secondaryBidPosition']);
|
||||||
const { claimId, claimName, contentName } = deprecatedParts;
|
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) {
|
if (!claimName && !channelName && !streamName) {
|
||||||
console.error(__("'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url."));
|
console.error(__("'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url."));
|
||||||
}
|
}
|
||||||
|
@ -4166,7 +4178,7 @@ function doCommentHide(comment_id) {
|
||||||
data: error
|
data: error
|
||||||
});
|
});
|
||||||
dispatch(doToast({
|
dispatch(doToast({
|
||||||
message: `SDK Errored when trying to hide Comment with comment_id: "${comment_id}"`,
|
message: 'There was an error hiding this comment. Please try again later.',
|
||||||
isError: true
|
isError: true
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@ -4194,7 +4206,7 @@ function doCommentAbandon(comment_id) {
|
||||||
data: error
|
data: error
|
||||||
});
|
});
|
||||||
dispatch(doToast({
|
dispatch(doToast({
|
||||||
message: `SDK Errored during abandon on Comment w/ ID = "${comment_id}"`,
|
message: 'There was an error hiding this comment. Please try again later.',
|
||||||
isError: true
|
isError: true
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@ -4223,7 +4235,7 @@ function doCommentUpdate(comment_id, comment) {
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch({ type: COMMENT_UPDATE_FAILED, data: error });
|
dispatch({ type: COMMENT_UPDATE_FAILED, data: error });
|
||||||
dispatch(doToast({
|
dispatch(doToast({
|
||||||
message: `SDK Errored during update on Comment w/ ID = ${comment_id}`,
|
message: 'There was an error hiding this comment. Please try again later.',
|
||||||
isError: true
|
isError: true
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@ -4732,11 +4744,7 @@ const commentReducer = handleActions({
|
||||||
const commentIds = byId[comment.claim_id];
|
const commentIds = byId[comment.claim_id];
|
||||||
byId[comment.claim_id] = commentIds.filter(commentId => commentId !== comment_id);
|
byId[comment.claim_id] = commentIds.filter(commentId => commentId !== comment_id);
|
||||||
|
|
||||||
Object.keys(commentById).forEach(commentId => {
|
delete commentById[comment_id];
|
||||||
if (commentId === comment_id) {
|
|
||||||
delete commentById[commentId];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return _extends$7({}, state, {
|
return _extends$7({}, state, {
|
||||||
commentById,
|
commentById,
|
||||||
|
@ -5668,12 +5676,10 @@ const selectCommentsByClaimId = reselect.createSelector(selectState$8, selectCom
|
||||||
const byClaimId = state.byId || {};
|
const byClaimId = state.byId || {};
|
||||||
const comments = {};
|
const comments = {};
|
||||||
|
|
||||||
// for every claimId -> commentId, put comments in the object
|
// replace every comment_id in the list with the actual comment object
|
||||||
Object.keys(byClaimId).forEach(claimId => {
|
Object.keys(byClaimId).forEach(claimId => {
|
||||||
// get all the commentIds that commented on this ClaimId
|
|
||||||
const commentIds = byClaimId[claimId];
|
const commentIds = byClaimId[claimId];
|
||||||
|
|
||||||
// map a new array of comments by the claimId
|
|
||||||
comments[claimId] = Array(commentIds === null ? 0 : commentIds.length);
|
comments[claimId] = Array(commentIds === null ? 0 : commentIds.length);
|
||||||
for (let i = 0; i < commentIds.length; i++) {
|
for (let i = 0; i < commentIds.length; i++) {
|
||||||
comments[claimId][i] = byId[commentIds[i]];
|
comments[claimId][i] = byId[commentIds[i]];
|
||||||
|
@ -5708,6 +5714,9 @@ const makeSelectCommentsForUri = uri => reselect.createSelector(selectCommentsBy
|
||||||
return byClaimId && byClaimId[claimId];
|
return byClaimId && byClaimId[claimId];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// todo: allow SDK to retrieve user comments through comment_list
|
||||||
|
// todo: implement selectors for selecting comments owned by user
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
const selectState$9 = state => state.tags || {};
|
const selectState$9 = state => state.tags || {};
|
||||||
|
|
|
@ -105,7 +105,7 @@ export function doCommentHide(comment_id: string) {
|
||||||
});
|
});
|
||||||
dispatch(
|
dispatch(
|
||||||
doToast({
|
doToast({
|
||||||
message: `SDK Errored when trying to hide Comment with comment_id: "${comment_id}"`,
|
message: 'There was an error hiding this comment. Please try again later.',
|
||||||
isError: true,
|
isError: true,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -137,7 +137,7 @@ export function doCommentAbandon(comment_id: string) {
|
||||||
});
|
});
|
||||||
dispatch(
|
dispatch(
|
||||||
doToast({
|
doToast({
|
||||||
message: `SDK Errored during abandon on Comment w/ ID = "${comment_id}"`,
|
message: 'There was an error hiding this comment. Please try again later.',
|
||||||
isError: true,
|
isError: true,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -170,7 +170,7 @@ export function doCommentUpdate(comment_id: string, comment: string) {
|
||||||
dispatch({ type: ACTIONS.COMMENT_UPDATE_FAILED, data: error });
|
dispatch({ type: ACTIONS.COMMENT_UPDATE_FAILED, data: error });
|
||||||
dispatch(
|
dispatch(
|
||||||
doToast({
|
doToast({
|
||||||
message: `SDK Errored during update on Comment w/ ID = ${comment_id}`,
|
message: 'There was an error hiding this comment. Please try again later.',
|
||||||
isError: true,
|
isError: true,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
@ -97,11 +97,7 @@ export const commentReducer = handleActions(
|
||||||
const commentIds = byId[comment.claim_id];
|
const commentIds = byId[comment.claim_id];
|
||||||
byId[comment.claim_id] = commentIds.filter(commentId => commentId !== comment_id);
|
byId[comment.claim_id] = commentIds.filter(commentId => commentId !== comment_id);
|
||||||
|
|
||||||
Object.keys(commentById).forEach(commentId => {
|
delete commentById[comment_id];
|
||||||
if (commentId === comment_id) {
|
|
||||||
delete commentById[commentId];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
|
|
|
@ -15,12 +15,10 @@ export const selectCommentsByClaimId = createSelector(
|
||||||
const byClaimId = state.byId || {};
|
const byClaimId = state.byId || {};
|
||||||
const comments = {};
|
const comments = {};
|
||||||
|
|
||||||
// for every claimId -> commentId, put comments in the object
|
// replace every comment_id in the list with the actual comment object
|
||||||
Object.keys(byClaimId).forEach(claimId => {
|
Object.keys(byClaimId).forEach(claimId => {
|
||||||
// get all the commentIds that commented on this ClaimId
|
|
||||||
const commentIds = byClaimId[claimId];
|
const commentIds = byClaimId[claimId];
|
||||||
|
|
||||||
// map a new array of comments by the claimId
|
|
||||||
comments[claimId] = Array(commentIds === null ? 0 : commentIds.length);
|
comments[claimId] = Array(commentIds === null ? 0 : commentIds.length);
|
||||||
for (let i = 0; i < commentIds.length; i++) {
|
for (let i = 0; i < commentIds.length; i++) {
|
||||||
comments[claimId][i] = byId[commentIds[i]];
|
comments[claimId][i] = byId[commentIds[i]];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue