Ocelot-Social/webapp/graphql/Moderation.js
mattwr18 517963174b We are not setting disable on Report node
- we are adding the report rule which says that if a resource was
disabled by a report with this rule, then the latest review was the one
that disabled it.
- fix db script/ add new directory for keeping record of db scripts
2019-12-05 19:52:05 +01:00

122 lines
2.5 KiB
JavaScript

import gql from 'graphql-tag'
export const reportsListQuery = () => {
// no limit for the moment like before: "reports(first: 20, orderBy: createdAt_desc)"
return gql`
query {
reports(orderBy: createdAt_desc) {
id
createdAt
updatedAt
closed
reviewed {
createdAt
updatedAt
disable
moderator {
id
slug
name
followedByCount
contributionsCount
commentedCount
}
}
resource {
__typename
... on User {
id
slug
name
disabled
deleted
followedByCount
contributionsCount
commentedCount
}
... on Comment {
id
contentExcerpt
disabled
deleted
author {
id
slug
name
disabled
deleted
followedByCount
contributionsCount
commentedCount
}
post {
id
slug
title
disabled
deleted
}
}
... on Post {
id
slug
title
disabled
deleted
author {
id
slug
name
disabled
deleted
followedByCount
contributionsCount
commentedCount
}
}
}
filed {
submitter {
id
slug
name
disabled
deleted
followedByCount
contributionsCount
commentedCount
}
createdAt
reasonCategory
reasonDescription
}
}
}
`
}
export const reportMutation = () => {
return gql`
mutation($resourceId: ID!, $reasonCategory: ReasonCategory!, $reasonDescription: String!) {
fileReport(
resourceId: $resourceId
reasonCategory: $reasonCategory
reasonDescription: $reasonDescription
) {
id
}
}
`
}
export const reviewMutation = () => {
return gql`
mutation($resourceId: ID!, $disable: Boolean, $closed: Boolean) {
review(resourceId: $resourceId, disable: $disable, closed: $closed) {
disable
closed
}
}
`
}