mirror of
https://github.com/wassname/talk.git
synced 2026-07-15 11:26:58 +08:00
Extended Asset with comment
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user