2020-02-18 07:57:00 +00:00
|
|
|
import gql from "graphql-tag";
|
2021-10-29 08:54:35 +00:00
|
|
|
import { ACTOR_FRAGMENT } from "./actor";
|
2019-11-15 17:36:47 +00:00
|
|
|
|
2020-02-18 07:57:00 +00:00
|
|
|
export const COMMENT_FIELDS_FRAGMENT_NAME = "CommentFields";
|
2019-11-15 17:36:47 +00:00
|
|
|
export const COMMENT_FIELDS_FRAGMENT = gql`
|
2020-02-18 07:57:00 +00:00
|
|
|
fragment CommentFields on Comment {
|
|
|
|
id
|
|
|
|
uuid
|
|
|
|
url
|
|
|
|
text
|
|
|
|
visibility
|
|
|
|
local
|
|
|
|
actor {
|
2021-10-29 08:54:35 +00:00
|
|
|
...ActorFragment
|
2020-02-18 07:57:00 +00:00
|
|
|
}
|
|
|
|
totalReplies
|
2021-05-17 07:38:04 +00:00
|
|
|
insertedAt
|
2020-02-18 07:57:00 +00:00
|
|
|
updatedAt
|
|
|
|
deletedAt
|
2021-06-01 16:08:03 +00:00
|
|
|
isAnnouncement
|
2021-11-13 14:58:54 +00:00
|
|
|
language
|
2020-02-18 07:57:00 +00:00
|
|
|
}
|
2021-10-29 08:54:35 +00:00
|
|
|
${ACTOR_FRAGMENT}
|
2019-11-15 17:36:47 +00:00
|
|
|
`;
|
|
|
|
|
|
|
|
export const COMMENT_RECURSIVE_FRAGMENT = gql`
|
2020-02-18 07:57:00 +00:00
|
|
|
fragment CommentRecursive on Comment {
|
|
|
|
...CommentFields
|
|
|
|
inReplyToComment {
|
|
|
|
...CommentFields
|
|
|
|
}
|
|
|
|
originComment {
|
|
|
|
...CommentFields
|
|
|
|
}
|
|
|
|
replies {
|
|
|
|
...CommentFields
|
2021-05-17 09:36:28 +00:00
|
|
|
inReplyToComment {
|
|
|
|
...CommentFields
|
|
|
|
}
|
|
|
|
originComment {
|
|
|
|
...CommentFields
|
|
|
|
}
|
2020-02-18 07:57:00 +00:00
|
|
|
replies {
|
2019-11-15 17:36:47 +00:00
|
|
|
...CommentFields
|
2020-02-18 07:57:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
${COMMENT_FIELDS_FRAGMENT}
|
2019-11-15 17:36:47 +00:00
|
|
|
`;
|
|
|
|
|
|
|
|
export const FETCH_THREAD_REPLIES = gql`
|
2021-05-17 16:19:24 +00:00
|
|
|
query FetchThreadReplies($threadId: ID!) {
|
2020-02-18 07:57:00 +00:00
|
|
|
thread(id: $threadId) {
|
|
|
|
...CommentRecursive
|
2019-11-15 17:36:47 +00:00
|
|
|
}
|
2020-02-18 07:57:00 +00:00
|
|
|
}
|
|
|
|
${COMMENT_RECURSIVE_FRAGMENT}
|
2019-11-15 17:36:47 +00:00
|
|
|
`;
|
|
|
|
|
|
|
|
export const COMMENTS_THREADS = gql`
|
2021-05-17 16:19:24 +00:00
|
|
|
query CommentThreads($eventUUID: UUID!) {
|
2020-02-18 07:57:00 +00:00
|
|
|
event(uuid: $eventUUID) {
|
|
|
|
id
|
|
|
|
uuid
|
|
|
|
comments {
|
2020-06-15 14:20:58 +00:00
|
|
|
...CommentFields
|
2020-02-18 07:57:00 +00:00
|
|
|
}
|
2019-11-15 17:36:47 +00:00
|
|
|
}
|
2020-02-18 07:57:00 +00:00
|
|
|
}
|
2020-06-15 14:20:58 +00:00
|
|
|
${COMMENT_FIELDS_FRAGMENT}
|
2019-11-15 17:36:47 +00:00
|
|
|
`;
|
|
|
|
|
2021-05-17 09:36:28 +00:00
|
|
|
export const COMMENTS_THREADS_WITH_REPLIES = gql`
|
2021-05-17 16:19:24 +00:00
|
|
|
query CommentThreadsWithReplies($eventUUID: UUID!) {
|
2021-05-17 09:36:28 +00:00
|
|
|
event(uuid: $eventUUID) {
|
|
|
|
id
|
|
|
|
uuid
|
|
|
|
comments {
|
|
|
|
...CommentRecursive
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
${COMMENT_RECURSIVE_FRAGMENT}
|
|
|
|
`;
|
|
|
|
|
2019-11-15 17:36:47 +00:00
|
|
|
export const CREATE_COMMENT_FROM_EVENT = gql`
|
2020-11-30 09:24:11 +00:00
|
|
|
mutation CreateCommentFromEvent(
|
|
|
|
$eventId: ID!
|
|
|
|
$text: String!
|
|
|
|
$inReplyToCommentId: ID
|
2021-06-01 16:08:03 +00:00
|
|
|
$isAnnouncement: Boolean
|
2020-11-30 09:24:11 +00:00
|
|
|
) {
|
|
|
|
createComment(
|
|
|
|
eventId: $eventId
|
|
|
|
text: $text
|
|
|
|
inReplyToCommentId: $inReplyToCommentId
|
2021-06-01 16:08:03 +00:00
|
|
|
isAnnouncement: $isAnnouncement
|
2020-11-30 09:24:11 +00:00
|
|
|
) {
|
2020-02-18 07:57:00 +00:00
|
|
|
...CommentRecursive
|
2019-11-15 17:36:47 +00:00
|
|
|
}
|
2020-02-18 07:57:00 +00:00
|
|
|
}
|
|
|
|
${COMMENT_RECURSIVE_FRAGMENT}
|
2019-11-15 17:36:47 +00:00
|
|
|
`;
|
|
|
|
|
|
|
|
export const DELETE_COMMENT = gql`
|
2020-08-14 09:32:23 +00:00
|
|
|
mutation DeleteComment($commentId: ID!) {
|
|
|
|
deleteComment(commentId: $commentId) {
|
2020-02-18 07:57:00 +00:00
|
|
|
id
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const UPDATE_COMMENT = gql`
|
|
|
|
mutation UpdateComment($commentId: ID!, $text: String!) {
|
|
|
|
updateComment(commentId: $commentId, text: $text) {
|
|
|
|
...CommentFields
|
2019-11-15 17:36:47 +00:00
|
|
|
}
|
2020-02-18 07:57:00 +00:00
|
|
|
}
|
2020-08-14 09:32:23 +00:00
|
|
|
${COMMENT_FIELDS_FRAGMENT}
|
2019-11-15 17:36:47 +00:00
|
|
|
`;
|