Handle temporary Commentron bugs
Can be removed when bugs are fixed, but would still work if left there.
This commit is contained in:
parent
5ef95846d8
commit
f8bdd0704f
3 changed files with 9 additions and 3 deletions
1
flow-typed/Comment.js
vendored
1
flow-typed/Comment.js
vendored
|
@ -108,6 +108,7 @@ declare type CommentByIdParams = {
|
|||
}
|
||||
|
||||
declare type CommentByIdResponse = {
|
||||
item: Comment,
|
||||
items: Comment,
|
||||
ancestors: Array<Comment>,
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue