Extended Asset with comment

This commit is contained in:
Belen Curcio
2017-07-24 16:31:24 -03:00
parent 4b74c3312f
commit 36df7cb784
4 changed files with 19 additions and 10 deletions
@@ -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,
@@ -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
+6
View File
@@ -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,
+3
View File
@@ -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