diff --git a/client/coral-embed-stream/src/components/Stream.js b/client/coral-embed-stream/src/components/Stream.js index 2a1381862..e6e184dfa 100644 --- a/client/coral-embed-stream/src/components/Stream.js +++ b/client/coral-embed-stream/src/components/Stream.js @@ -81,7 +81,7 @@ class Stream extends React.Component { setActiveReplyBox, appendItemArray, commentClassNames, - root: {asset, asset: {comments, totalCommentCount}, comment, me}, + root: {asset, asset: {comment, comments, totalCommentCount}, me}, postComment, addNotification, editComment, diff --git a/client/coral-embed-stream/src/containers/Stream.js b/client/coral-embed-stream/src/containers/Stream.js index ea0676e51..804f3d37e 100644 --- a/client/coral-embed-stream/src/containers/Stream.js +++ b/client/coral-embed-stream/src/containers/Stream.js @@ -237,16 +237,16 @@ const slots = [ const fragments = { root: gql` fragment CoralEmbedStream_Stream_root on RootQuery { - comment(id: $commentId) @include(if: $hasComment) { - ...CoralEmbedStream_Stream_comment - ${nest(` - parent { - ...CoralEmbedStream_Stream_comment - ...nest - } - `, THREADING_LEVEL)} - } asset(id: $assetId, url: $assetUrl) { + comment(id: $commentId) @include(if: $hasComment) { + ...CoralEmbedStream_Stream_comment + ${nest(` + parent { + ...CoralEmbedStream_Stream_comment + ...nest + } + `, THREADING_LEVEL)} + } id title url diff --git a/graph/resolvers/asset.js b/graph/resolvers/asset.js index 86e102631..497ea0f9b 100644 --- a/graph/resolvers/asset.js +++ b/graph/resolvers/asset.js @@ -4,6 +4,12 @@ const Asset = { recentComments({id}, _, {loaders: {Comments}}) { return Comments.genRecentComments.load(id); }, + comment({id}, {id: commentId}, {loaders: {Comments}}) { + return Comments.getByQuery({ + asset_id: id, + ids: commentId + }).then((c) => c.nodes[0]); + }, comments({id}, {sort, limit, deep, excludeIgnored, tags}, {loaders: {Comments}}) { return Comments.getByQuery({ asset_id: id, diff --git a/graph/typeDefs.graphql b/graph/typeDefs.graphql index a154f9f90..999aea51c 100644 --- a/graph/typeDefs.graphql +++ b/graph/typeDefs.graphql @@ -580,6 +580,9 @@ type Asset { deep: Boolean, ): CommentConnection! + # A Comment from the Asset by comment's ID + comment(id: ID!): Comment + # The count of top level comments on the asset. commentCount(excludeIgnored: Boolean, tags: [String!]): Int