mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Use of mutation disable removed
- The mutation definition still has to be removed.
This commit is contained in:
parent
4a6f8c423e
commit
a4521b4621
@ -111,15 +111,22 @@ beforeAll(async () => {
|
||||
mutate = client.mutate
|
||||
|
||||
authenticatedUser = await moderator.toJson()
|
||||
const disableMutation = gql`
|
||||
mutation($id: ID!) {
|
||||
disable(id: $id)
|
||||
const decideMutation = gql`
|
||||
mutation($resourceId: ID!, $disable: Boolean, $closed: Boolean) {
|
||||
decide(resourceId: $resourceId, disable: $disable, closed: $closed) {
|
||||
disable
|
||||
}
|
||||
}
|
||||
`
|
||||
const disableVariables = {
|
||||
resourceId: 'undefined-resource',
|
||||
disable: true,
|
||||
closed: false,
|
||||
}
|
||||
await Promise.all([
|
||||
mutate({ mutation: disableMutation, variables: { id: 'c1' } }),
|
||||
mutate({ mutation: disableMutation, variables: { id: 'u2' } }),
|
||||
mutate({ mutation: disableMutation, variables: { id: 'p2' } }),
|
||||
mutate({ mutation: decideMutation, variables: { ...disableVariables, resourceId: 'c1' } }),
|
||||
mutate({ mutation: decideMutation, variables: { ...disableVariables, resourceId: 'u2' } }),
|
||||
mutate({ mutation: decideMutation, variables: { ...disableVariables, resourceId: 'p2' } }),
|
||||
])
|
||||
authenticatedUser = null
|
||||
})
|
||||
|
||||
@ -19,11 +19,13 @@ const disable = async id => {
|
||||
req = { headers: { authorization: `Bearer ${moderatorBearerToken}` } }
|
||||
await mutate({
|
||||
mutation: gql`
|
||||
mutation($id: ID!) {
|
||||
disable(id: $id)
|
||||
mutation($resourceId: ID!, $disable: Boolean, $closed: Boolean) {
|
||||
decide(resourceId: $resourceId, disable: $disable, closed: $closed) {
|
||||
disable
|
||||
}
|
||||
}
|
||||
`,
|
||||
variables: { id },
|
||||
variables: { resourceId: id, disable: true, closed: false },
|
||||
})
|
||||
req = { headers: {} }
|
||||
}
|
||||
|
||||
@ -536,7 +536,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
postId: 'p3',
|
||||
}),
|
||||
factory.create('Comment', {
|
||||
author: bobDerBaumeister,
|
||||
author: jennyRostock,
|
||||
id: 'c5',
|
||||
postId: 'p3',
|
||||
}),
|
||||
@ -639,28 +639,6 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
louie.relateTo(p10, 'shouted'),
|
||||
])
|
||||
|
||||
const disableMutation = gql`
|
||||
mutation($id: ID!) {
|
||||
disable(id: $id)
|
||||
}
|
||||
`
|
||||
authenticatedUser = await bobDerBaumeister.toJson()
|
||||
await Promise.all([
|
||||
mutate({
|
||||
mutation: disableMutation,
|
||||
variables: {
|
||||
id: 'p11',
|
||||
},
|
||||
}),
|
||||
mutate({
|
||||
mutation: disableMutation,
|
||||
variables: {
|
||||
id: 'c5',
|
||||
},
|
||||
}),
|
||||
])
|
||||
authenticatedUser = null
|
||||
|
||||
// There is no error logged or the 'try' fails if this mutation is wrong. Why?
|
||||
const reportMutation = gql`
|
||||
mutation($resourceId: ID!, $reasonCategory: ReasonCategory!, $reasonDescription: String!) {
|
||||
@ -675,6 +653,22 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
`
|
||||
authenticatedUser = await huey.toJson()
|
||||
await Promise.all([
|
||||
mutate({
|
||||
mutation: reportMutation,
|
||||
variables: {
|
||||
resourceId: 'p11',
|
||||
reasonCategory: 'discrimination_etc',
|
||||
reasonDescription: 'I am what I am !!!',
|
||||
},
|
||||
}),
|
||||
mutate({
|
||||
mutation: reportMutation,
|
||||
variables: {
|
||||
resourceId: 'c5',
|
||||
reasonCategory: 'doxing',
|
||||
reasonDescription: "This shouldn't be shown to anybody else! It's my privat thing!",
|
||||
},
|
||||
}),
|
||||
mutate({
|
||||
mutation: reportMutation,
|
||||
variables: {
|
||||
@ -730,6 +724,39 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
||||
])
|
||||
authenticatedUser = null
|
||||
|
||||
// only decide after report !!!
|
||||
const decideMutation = gql`
|
||||
mutation($resourceId: ID!, $disable: Boolean, $closed: Boolean) {
|
||||
decide(resourceId: $resourceId, disable: $disable, closed: $closed) {
|
||||
disable
|
||||
}
|
||||
}
|
||||
`
|
||||
const disableVariables = {
|
||||
resourceId: 'undefined-resource',
|
||||
disable: true,
|
||||
closed: false,
|
||||
}
|
||||
authenticatedUser = await bobDerBaumeister.toJson()
|
||||
await Promise.all([
|
||||
mutate({
|
||||
mutation: decideMutation,
|
||||
variables: {
|
||||
...disableVariables,
|
||||
resourceId: 'p11',
|
||||
},
|
||||
}),
|
||||
mutate({
|
||||
mutation: decideMutation,
|
||||
variables: {
|
||||
...disableVariables,
|
||||
resourceId: 'c5',
|
||||
closed: true,
|
||||
},
|
||||
}),
|
||||
])
|
||||
authenticatedUser = null
|
||||
|
||||
await Promise.all(
|
||||
[...Array(30).keys()].map(i => {
|
||||
return factory.create('User')
|
||||
|
||||
@ -54,11 +54,13 @@ export default {
|
||||
// await this.modalData.buttons.confirm.callback()
|
||||
await this.$apollo.mutate({
|
||||
mutation: gql`
|
||||
mutation($id: ID!) {
|
||||
disable(id: $id)
|
||||
mutation($resourceId: ID!, $disable: Boolean, $closed: Boolean) {
|
||||
decide(resourceId: $resourceId, disable: $disable, closed: $closed) {
|
||||
disable
|
||||
}
|
||||
}
|
||||
`,
|
||||
variables: { id: this.id },
|
||||
variables: { resourceId: this.id, disable: true, closed: false },
|
||||
})
|
||||
this.$toast.success(this.$t('disable.success'))
|
||||
this.isOpen = false
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user