diff --git a/flow-typed/Comment.js b/flow-typed/Comment.js index b0a09af3c..15c6d3038 100644 --- a/flow-typed/Comment.js +++ b/flow-typed/Comment.js @@ -108,6 +108,7 @@ declare type CommentByIdParams = { } declare type CommentByIdResponse = { + item: Comment, items: Comment, ancestors: Array, } diff --git a/ui/redux/actions/comments.js b/ui/redux/actions/comments.js index 6a39e5847..ff09049d7 100644 --- a/ui/redux/actions/comments.js +++ b/ui/redux/actions/comments.js @@ -109,12 +109,12 @@ export function doCommentById(commentId: string) { return (dispatch: Dispatch, getState: GetState) => { return Comments.comment_by_id({ comment_id: commentId, with_ancestors: true }) .then((result: CommentByIdResponse) => { - const { items, ancestors } = result; + const { item, items, ancestors } = result; dispatch({ type: ACTIONS.COMMENT_BY_ID_COMPLETED, data: { - comment: items, + comment: item || items, // Requested a change to rename it to 'item'. This covers both. ancestors: ancestors, }, }); diff --git a/ui/redux/reducers/comments.js b/ui/redux/reducers/comments.js index 4f2bb8a06..88ff167ea 100644 --- a/ui/redux/reducers/comments.js +++ b/ui/redux/reducers/comments.js @@ -287,10 +287,15 @@ export default handleActions( // in reality this doesn't matter and we can just // sort comments by their timestamp const commentIds = Array(comments.length); - totalCommentsById[claimId] = totalItems; + + // totalCommentsById[claimId] = totalItems; + // --> currently, this value is only correct when done via a top-level query. + // Until this is fixed, I'm moving it downwards to ** // --- Top-level comments --- if (!parentId) { + totalCommentsById[claimId] = totalItems; // ** + topLevelTotalCommentsById[claimId] = totalFilteredItems; topLevelTotalPagesById[claimId] = totalPages;