Introduce comments below events

Also add tomstones

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-11-15 18:36:47 +01:00
parent 45155a3bde
commit dc07f34d78
71 changed files with 2642 additions and 879 deletions

83
js/src/graphql/comment.ts Normal file
View File

@@ -0,0 +1,83 @@
import gql from 'graphql-tag';
export const COMMENT_FIELDS_FRAGMENT_NAME = 'CommentFields';
export const COMMENT_FIELDS_FRAGMENT = gql`
fragment CommentFields on Comment {
id,
uuid,
url,
text,
visibility,
actor {
avatar {
url
},
id,
preferredUsername,
name
},
totalReplies,
updatedAt,
deletedAt
},
`;
export const COMMENT_RECURSIVE_FRAGMENT = gql`
fragment CommentRecursive on Comment {
...CommentFields
inReplyToComment {
...CommentFields
},
originComment {
...CommentFields
},
replies {
...CommentFields
replies {
...CommentFields
}
},
},
${COMMENT_FIELDS_FRAGMENT}
`;
export const FETCH_THREAD_REPLIES = gql`
query($threadId: ID!) {
thread(id: $threadId) {
...CommentRecursive
}
}
${COMMENT_RECURSIVE_FRAGMENT}
`;
export const COMMENTS_THREADS = gql`
query($eventUUID: UUID!) {
event(uuid: $eventUUID) {
id,
uuid,
comments {
...CommentFields,
}
}
}
${COMMENT_RECURSIVE_FRAGMENT}
`;
export const CREATE_COMMENT_FROM_EVENT = gql`
mutation CreateCommentFromEvent($eventId: ID!, $actorId: ID!, $text: String!, $inReplyToCommentId: ID) {
createComment(eventId: $eventId, actorId: $actorId, text: $text, inReplyToCommentId: $inReplyToCommentId) {
...CommentRecursive
}
}
${COMMENT_RECURSIVE_FRAGMENT}
`;
export const DELETE_COMMENT = gql`
mutation DeleteComment($commentId: ID!, $actorId: ID!) {
deleteComment(commentId: $commentId, actorId: $actorId) {
id
}
}
`;

View File

@@ -1,4 +1,5 @@
import gql from 'graphql-tag';
import { COMMENT_FIELDS_FRAGMENT } from '@/graphql/comment';
const participantQuery = `
role,
@@ -135,6 +136,7 @@ export const FETCH_EVENT = gql`
}
}
}
${COMMENT_FIELDS_FRAGMENT}
`;
export const FETCH_EVENTS = gql`

View File

@@ -29,7 +29,8 @@ export const REPORTS = gql`
url
}
},
status
status,
content
}
}
`;
@@ -63,10 +64,23 @@ const REPORT_FRAGMENT = gql`
url
}
},
comments {
id,
text,
actor {
id,
preferredUsername,
name,
avatar {
url
}
}
}
notes {
id,
content
moderator {
id,
preferredUsername,
name,
avatar {
@@ -94,11 +108,12 @@ export const REPORT = gql`
export const CREATE_REPORT = gql`
mutation CreateReport(
$eventId: ID!,
$reporterActorId: ID!,
$reportedActorId: ID!,
$content: String
$reporterId: ID!,
$reportedId: ID!,
$content: String,
$commentsIds: [ID]
) {
createReport(eventId: $eventId, reporterActorId: $reporterActorId, reportedActorId: $reportedActorId, content: $content) {
createReport(eventId: $eventId, reporterId: $reporterId, reportedId: $reportedId, content: $content, commentsIds: $commentsIds) {
id
}
}