From 153c5acce1370dd98bde7f0bebffbbc3d89ee20c Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Mon, 28 Aug 2017 19:15:29 +0700 Subject: [PATCH 1/3] Only load my own comments in history --- client/coral-settings/containers/ProfileContainer.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/coral-settings/containers/ProfileContainer.js b/client/coral-settings/containers/ProfileContainer.js index e6dad3899..4a9aea911 100644 --- a/client/coral-settings/containers/ProfileContainer.js +++ b/client/coral-settings/containers/ProfileContainer.js @@ -37,7 +37,7 @@ class ProfileContainer extends Component { limit: 5, cursor: this.props.root.me.comments.endCursor, }, - updateQuery: (previous, {fetchMoreResult:{comments}}) => { + updateQuery: (previous, {fetchMoreResult:{me: {comments}}}) => { const updated = update(previous, { me: { comments: { @@ -124,8 +124,10 @@ const CommentFragment = gql` const LOAD_MORE_QUERY = gql` query TalkSettings_LoadMoreComments($limit: Int, $cursor: Date) { - comments(query: {limit: $limit, cursor: $cursor}) { - ...TalkSettings_CommentConnectionFragment + me { + comments(query: {limit: $limit, cursor: $cursor}) { + ...TalkSettings_CommentConnectionFragment + } } } ${CommentFragment} From 7856c9d9479d94ad69a2bb980d96330005036a77 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Mon, 28 Aug 2017 21:05:32 +0700 Subject: [PATCH 2/3] Fix live update false comments in permalink view --- client/coral-embed-stream/src/graphql/utils.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/coral-embed-stream/src/graphql/utils.js b/client/coral-embed-stream/src/graphql/utils.js index 11d3d411b..712506692 100644 --- a/client/coral-embed-stream/src/graphql/utils.js +++ b/client/coral-embed-stream/src/graphql/utils.js @@ -36,11 +36,15 @@ function applyToCommentsOrigin(root, callback) { } function findAndInsertComment(parent, comment) { - const [connectionField, countField, action] = parent.__typename === 'Asset' + const isAsset = parent.__typename === 'Asset'; + const [connectionField, countField, action] = isAsset ? ['comments', 'commentCount', '$unshift'] : ['replies', 'replyCount', '$push']; - if (!comment.parent || parent.id === comment.parent.id) { + if ( + !comment.parent && isAsset // A top level comment in the asset. + || comment.parent && parent.id === comment.parent.id // A reply at the correct parent. + ) { return update(parent, { [connectionField]: { nodes: {[action]: [comment]}, From 8cfccb7b00df7d9658a4a22f90f99f6ff04d1378 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Mon, 28 Aug 2017 09:42:37 -0600 Subject: [PATCH 3/3] fixed query --- graph/resolvers/asset.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/graph/resolvers/asset.js b/graph/resolvers/asset.js index a48af7674..b5fd92d34 100644 --- a/graph/resolvers/asset.js +++ b/graph/resolvers/asset.js @@ -21,6 +21,9 @@ const Asset = { query.parent_id = null; } + // Include the asset id in the search. + query.asset_id = id; + return Comments.getByQuery(query); }, commentCount({id, commentCount}, {tags}, {loaders: {Comments}}) {