Fix double linked-comment if it was also pinned
## Issue If the linked-comment is also a pinned comment, it was displayed twice. ## Fix When separating out pinned comments, I forgot that `comment.ByID` was another place where we fetch comments.
This commit is contained in:
parent
fb03d3a7f9
commit
882c9ca022
1 changed files with 10 additions and 1 deletions
|
@ -349,6 +349,7 @@ export default handleActions(
|
||||||
const topLevelCommentsById = Object.assign({}, state.topLevelCommentsById); // was byId {ClaimId -> [commentIds...]}
|
const topLevelCommentsById = Object.assign({}, state.topLevelCommentsById); // was byId {ClaimId -> [commentIds...]}
|
||||||
const topLevelTotalCommentsById = Object.assign({}, state.topLevelTotalCommentsById);
|
const topLevelTotalCommentsById = Object.assign({}, state.topLevelTotalCommentsById);
|
||||||
const topLevelTotalPagesById = Object.assign({}, state.topLevelTotalPagesById);
|
const topLevelTotalPagesById = Object.assign({}, state.topLevelTotalPagesById);
|
||||||
|
const pinnedCommentsById = Object.assign({}, state.pinnedCommentsById);
|
||||||
const repliesByParentId = Object.assign({}, state.repliesByParentId);
|
const repliesByParentId = Object.assign({}, state.repliesByParentId);
|
||||||
const linkedCommentAncestors = Object.assign({}, state.linkedCommentAncestors);
|
const linkedCommentAncestors = Object.assign({}, state.linkedCommentAncestors);
|
||||||
|
|
||||||
|
@ -361,9 +362,13 @@ export default handleActions(
|
||||||
const parentId = comment.parent_id;
|
const parentId = comment.parent_id;
|
||||||
if (comment.parent_id) {
|
if (comment.parent_id) {
|
||||||
pushToArrayInObject(repliesByParentId, parentId, comment.comment_id);
|
pushToArrayInObject(repliesByParentId, parentId, comment.comment_id);
|
||||||
|
} else {
|
||||||
|
if (comment.is_pinned) {
|
||||||
|
pushToArrayInObject(pinnedCommentsById, claimId, comment.comment_id);
|
||||||
} else {
|
} else {
|
||||||
pushToArrayInObject(topLevelCommentsById, claimId, comment.comment_id);
|
pushToArrayInObject(topLevelCommentsById, claimId, comment.comment_id);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
updateStore(comment, commentById, byId, repliesByParentId, topLevelCommentsById);
|
updateStore(comment, commentById, byId, repliesByParentId, topLevelCommentsById);
|
||||||
|
@ -380,6 +385,7 @@ export default handleActions(
|
||||||
topLevelCommentsById,
|
topLevelCommentsById,
|
||||||
topLevelTotalCommentsById,
|
topLevelTotalCommentsById,
|
||||||
topLevelTotalPagesById,
|
topLevelTotalPagesById,
|
||||||
|
pinnedCommentsById,
|
||||||
repliesByParentId,
|
repliesByParentId,
|
||||||
byId,
|
byId,
|
||||||
commentById,
|
commentById,
|
||||||
|
@ -422,6 +428,7 @@ export default handleActions(
|
||||||
const topLevelCommentsById = Object.assign({}, state.topLevelCommentsById); // was byId {ClaimId -> [commentIds...]}
|
const topLevelCommentsById = Object.assign({}, state.topLevelCommentsById); // was byId {ClaimId -> [commentIds...]}
|
||||||
const topLevelTotalCommentsById = Object.assign({}, state.topLevelTotalCommentsById);
|
const topLevelTotalCommentsById = Object.assign({}, state.topLevelTotalCommentsById);
|
||||||
const topLevelTotalPagesById = Object.assign({}, state.topLevelTotalPagesById);
|
const topLevelTotalPagesById = Object.assign({}, state.topLevelTotalPagesById);
|
||||||
|
const pinnedCommentsById = Object.assign({}, state.pinnedCommentsById);
|
||||||
const myReacts = Object.assign({}, state.myReactsByCommentId);
|
const myReacts = Object.assign({}, state.myReactsByCommentId);
|
||||||
const othersReacts = Object.assign({}, state.othersReactsByCommentId);
|
const othersReacts = Object.assign({}, state.othersReactsByCommentId);
|
||||||
|
|
||||||
|
@ -446,6 +453,7 @@ export default handleActions(
|
||||||
delete topLevelCommentsById[claimId];
|
delete topLevelCommentsById[claimId];
|
||||||
delete topLevelTotalCommentsById[claimId];
|
delete topLevelTotalCommentsById[claimId];
|
||||||
delete topLevelTotalPagesById[claimId];
|
delete topLevelTotalPagesById[claimId];
|
||||||
|
delete pinnedCommentsById[claimId];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
|
@ -454,6 +462,7 @@ export default handleActions(
|
||||||
topLevelCommentsById,
|
topLevelCommentsById,
|
||||||
topLevelTotalCommentsById,
|
topLevelTotalCommentsById,
|
||||||
topLevelTotalPagesById,
|
topLevelTotalPagesById,
|
||||||
|
pinnedCommentsById,
|
||||||
myReactsByCommentId: myReacts,
|
myReactsByCommentId: myReacts,
|
||||||
othersReactsByCommentId: othersReacts,
|
othersReactsByCommentId: othersReacts,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue