2020-02-18 08:57:00 +01:00
|
|
|
import gql from "graphql-tag";
|
2019-11-15 18:36:47 +01:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
export const COMMENT_FIELDS_FRAGMENT_NAME = "CommentFields";
|
2019-11-15 18:36:47 +01:00
|
|
|
export const COMMENT_FIELDS_FRAGMENT = gql`
|
2020-02-18 08:57:00 +01:00
|
|
|
fragment CommentFields on Comment {
|
|
|
|
id
|
|
|
|
uuid
|
|
|
|
url
|
|
|
|
text
|
|
|
|
visibility
|
|
|
|
local
|
|
|
|
actor {
|
|
|
|
avatar {
|
2020-10-22 16:19:26 +02:00
|
|
|
id
|
2020-02-18 08:57:00 +01:00
|
|
|
url
|
|
|
|
}
|
|
|
|
id
|
|
|
|
domain
|
|
|
|
preferredUsername
|
|
|
|
name
|
2020-06-15 16:20:58 +02:00
|
|
|
summary
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
|
|
|
totalReplies
|
|
|
|
updatedAt
|
|
|
|
deletedAt
|
|
|
|
}
|
2019-11-15 18:36:47 +01:00
|
|
|
`;
|
|
|
|
|
|
|
|
export const COMMENT_RECURSIVE_FRAGMENT = gql`
|
2020-02-18 08:57:00 +01:00
|
|
|
fragment CommentRecursive on Comment {
|
|
|
|
...CommentFields
|
|
|
|
inReplyToComment {
|
|
|
|
...CommentFields
|
|
|
|
}
|
|
|
|
originComment {
|
|
|
|
...CommentFields
|
|
|
|
}
|
|
|
|
replies {
|
|
|
|
...CommentFields
|
|
|
|
replies {
|
2019-11-15 18:36:47 +01:00
|
|
|
...CommentFields
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
${COMMENT_FIELDS_FRAGMENT}
|
2019-11-15 18:36:47 +01:00
|
|
|
`;
|
|
|
|
|
|
|
|
export const FETCH_THREAD_REPLIES = gql`
|
2020-02-18 08:57:00 +01:00
|
|
|
query($threadId: ID!) {
|
|
|
|
thread(id: $threadId) {
|
|
|
|
...CommentRecursive
|
2019-11-15 18:36:47 +01:00
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
|
|
|
${COMMENT_RECURSIVE_FRAGMENT}
|
2019-11-15 18:36:47 +01:00
|
|
|
`;
|
|
|
|
|
|
|
|
export const COMMENTS_THREADS = gql`
|
2020-02-18 08:57:00 +01:00
|
|
|
query($eventUUID: UUID!) {
|
|
|
|
event(uuid: $eventUUID) {
|
|
|
|
id
|
|
|
|
uuid
|
|
|
|
comments {
|
2020-06-15 16:20:58 +02:00
|
|
|
...CommentFields
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
2019-11-15 18:36:47 +01:00
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
2020-06-15 16:20:58 +02:00
|
|
|
${COMMENT_FIELDS_FRAGMENT}
|
2019-11-15 18:36:47 +01:00
|
|
|
`;
|
|
|
|
|
|
|
|
export const CREATE_COMMENT_FROM_EVENT = gql`
|
2020-11-19 17:06:28 +01:00
|
|
|
mutation CreateCommentFromEvent($eventId: ID!, $text: String!, $inReplyToCommentId: ID) {
|
|
|
|
createComment(eventId: $eventId, text: $text, inReplyToCommentId: $inReplyToCommentId) {
|
2020-02-18 08:57:00 +01:00
|
|
|
...CommentRecursive
|
2019-11-15 18:36:47 +01:00
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
|
|
|
${COMMENT_RECURSIVE_FRAGMENT}
|
2019-11-15 18:36:47 +01:00
|
|
|
`;
|
|
|
|
|
|
|
|
export const DELETE_COMMENT = gql`
|
2020-08-14 11:32:23 +02:00
|
|
|
mutation DeleteComment($commentId: ID!) {
|
|
|
|
deleteComment(commentId: $commentId) {
|
2020-02-18 08:57:00 +01:00
|
|
|
id
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const UPDATE_COMMENT = gql`
|
|
|
|
mutation UpdateComment($commentId: ID!, $text: String!) {
|
|
|
|
updateComment(commentId: $commentId, text: $text) {
|
|
|
|
...CommentFields
|
2019-11-15 18:36:47 +01:00
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
2020-08-14 11:32:23 +02:00
|
|
|
${COMMENT_FIELDS_FRAGMENT}
|
2019-11-15 18:36:47 +01:00
|
|
|
`;
|