mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Implement 'decide' button and functionality
This commit is contained in:
parent
c2444a5288
commit
553a3ca2cb
@ -31,7 +31,10 @@ export default {
|
|||||||
|
|
||||||
const session = driver.session()
|
const session = driver.session()
|
||||||
try {
|
try {
|
||||||
const queryOpenDecisionWriteTxResultPromise = queryOpenDecisionWriteTransaction(session, resourceId)
|
const queryOpenDecisionWriteTxResultPromise = queryOpenDecisionWriteTransaction(
|
||||||
|
session,
|
||||||
|
resourceId,
|
||||||
|
)
|
||||||
const [openDecisionTxResult] = await queryOpenDecisionWriteTxResultPromise
|
const [openDecisionTxResult] = await queryOpenDecisionWriteTxResultPromise
|
||||||
|
|
||||||
let cypherHeader = ''
|
let cypherHeader = ''
|
||||||
@ -50,7 +53,8 @@ export default {
|
|||||||
CREATE (resource)<-[decision:DECIDED]-(moderator)
|
CREATE (resource)<-[decision:DECIDED]-(moderator)
|
||||||
SET decision.latest = true
|
SET decision.latest = true
|
||||||
`
|
`
|
||||||
} else { // an open decision, then change it
|
} else {
|
||||||
|
// an open decision, then change it
|
||||||
if (disable === undefined) disable = openDecisionTxResult.decision.properties.disable // default set to existing
|
if (disable === undefined) disable = openDecisionTxResult.decision.properties.disable // default set to existing
|
||||||
if (closed === undefined) closed = openDecisionTxResult.decision.properties.closed // default set to existing
|
if (closed === undefined) closed = openDecisionTxResult.decision.properties.closed // default set to existing
|
||||||
// current moderator is not the same as old
|
// current moderator is not the same as old
|
||||||
@ -100,8 +104,7 @@ export default {
|
|||||||
// console.log('disable: ', disable)
|
// console.log('disable: ', disable)
|
||||||
|
|
||||||
const mutateDecisionWriteTxResultPromise = session.writeTransaction(async txc => {
|
const mutateDecisionWriteTxResultPromise = session.writeTransaction(async txc => {
|
||||||
const mutateDecisionTransactionResponse = await txc.run(
|
const mutateDecisionTransactionResponse = await txc.run(cypher, {
|
||||||
cypher, {
|
|
||||||
resourceId,
|
resourceId,
|
||||||
moderatorId: moderator.id,
|
moderatorId: moderator.id,
|
||||||
disable,
|
disable,
|
||||||
|
|||||||
@ -110,3 +110,13 @@ export const reportMutation = () => {
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const decideMutation = () => {
|
||||||
|
return gql`
|
||||||
|
mutation($resourceId: ID!, $disable: Boolean, $closed: Boolean) {
|
||||||
|
decide(resourceId: $resourceId, disable: $disable, closed: $closed) {
|
||||||
|
disable
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|||||||
@ -454,9 +454,11 @@
|
|||||||
"typeRowHeadline": "Typ",
|
"typeRowHeadline": "Typ",
|
||||||
"contentRowHeadline": "Inhalt",
|
"contentRowHeadline": "Inhalt",
|
||||||
"authorRowHeadline": "Autor",
|
"authorRowHeadline": "Autor",
|
||||||
"decisionRowHeadline": "Decision",
|
"decisionRowHeadline": "Entscheidung",
|
||||||
"decided": "Entschieden",
|
"decided": "Entschieden",
|
||||||
"noDecision": "Keine Entscheidung!",
|
"noDecision": "Keine Entscheidung!",
|
||||||
|
"decideButton": "Entscheide",
|
||||||
|
"DecisionSuccess": "Erfolgreich entschieden!",
|
||||||
"enabledBy": "Aktiviert von",
|
"enabledBy": "Aktiviert von",
|
||||||
"disabledBy": "Deaktiviert von",
|
"disabledBy": "Deaktiviert von",
|
||||||
"reasonCategory": "Kategorie",
|
"reasonCategory": "Kategorie",
|
||||||
|
|||||||
@ -458,6 +458,8 @@
|
|||||||
"decisionRowHeadline": "Decision",
|
"decisionRowHeadline": "Decision",
|
||||||
"decided": "Decided",
|
"decided": "Decided",
|
||||||
"noDecision": "No decision!",
|
"noDecision": "No decision!",
|
||||||
|
"decideButton": "Decide",
|
||||||
|
"DecisionSuccess": "Decided successfully!",
|
||||||
"enabledBy": "Enabled by",
|
"enabledBy": "Enabled by",
|
||||||
"disabledBy": "Disabled by",
|
"disabledBy": "Disabled by",
|
||||||
"reasonCategory": "Category",
|
"reasonCategory": "Category",
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
cellpadding="0"
|
cellpadding="0"
|
||||||
>
|
>
|
||||||
<colgroup><col width="" /></colgroup>
|
<colgroup><col width="" /></colgroup>
|
||||||
<template v-for="content in reportedContentStructure">
|
<template v-for="(content, index) in reportedContentStructure">
|
||||||
<thead
|
<thead
|
||||||
:class="[
|
:class="[
|
||||||
content.closed ? 'decision' : 'no-decision',
|
content.closed ? 'decision' : 'no-decision',
|
||||||
@ -77,28 +77,30 @@
|
|||||||
<hc-user :user="content.user" :showAvatar="false" :trunc="30" />
|
<hc-user :user="content.user" :showAvatar="false" :trunc="30" />
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
<!-- contentBelongsToUser -->
|
||||||
<td class="ds-table-col ds-table-head-col-border">
|
<td class="ds-table-col ds-table-head-col-border">
|
||||||
<ds-flex v-if="content.contentBelongsToUser">
|
<hc-user
|
||||||
<ds-flex-item width="20px">
|
v-if="content.contentBelongsToUser"
|
||||||
<ds-icon
|
:user="content.contentBelongsToUser"
|
||||||
v-tooltip="{ content: $t('report.author'), placement: 'right' }"
|
:showAvatar="false"
|
||||||
name="user"
|
:trunc="30"
|
||||||
/>
|
/>
|
||||||
</ds-flex-item>
|
|
||||||
<ds-flex-item>
|
|
||||||
<hc-user :user="content.contentBelongsToUser" :showAvatar="false" :trunc="30" />
|
|
||||||
</ds-flex-item>
|
|
||||||
</ds-flex>
|
|
||||||
<span v-else>—</span>
|
<span v-else>—</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="ds-table-col ds-table-head-col-border">
|
<td class="ds-table-col ds-table-head-col-border">
|
||||||
<!-- closed -->
|
<!-- closed -->
|
||||||
<b v-if="content.closed" class="decision">
|
<b v-if="content.closed">
|
||||||
{{ $t('moderation.reports.decided') }}
|
{{ $t('moderation.reports.decided') }}
|
||||||
</b>
|
</b>
|
||||||
<b v-else class="no-decision">
|
<ds-button
|
||||||
{{ $t('moderation.reports.noDecision') }}
|
v-else
|
||||||
</b>
|
danger
|
||||||
|
class="confirm"
|
||||||
|
icon="exclamation-circle"
|
||||||
|
@click="confirm(content.resource.id, index)"
|
||||||
|
>
|
||||||
|
{{ $t('moderation.reports.decideButton') }}
|
||||||
|
</ds-button>
|
||||||
<!-- decidedByModerator -->
|
<!-- decidedByModerator -->
|
||||||
<div v-if="content.resource.decidedByModerator">
|
<div v-if="content.resource.decidedByModerator">
|
||||||
<br />
|
<br />
|
||||||
@ -153,7 +155,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import HcEmpty from '~/components/Empty.vue'
|
import HcEmpty from '~/components/Empty.vue'
|
||||||
import HcUser from '~/components/User/User'
|
import HcUser from '~/components/User/User'
|
||||||
import { reportListQuery } from '~/graphql/Moderation.js'
|
import { reportListQuery, decideMutation } from '~/graphql/Moderation.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -231,9 +233,29 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
async confirm(resourceId, index) {
|
||||||
|
this.$apollo
|
||||||
|
.mutate({
|
||||||
|
mutation: decideMutation(),
|
||||||
|
variables: { resourceId, closed: true },
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.$toast.success(this.$t('moderation.reports.DecisionSuccess'))
|
||||||
|
this.$apollo.queries.reports.refetch()
|
||||||
|
})
|
||||||
|
.catch(error => this.$toast.error(error.message))
|
||||||
|
},
|
||||||
|
},
|
||||||
apollo: {
|
apollo: {
|
||||||
reports: {
|
reports: {
|
||||||
query: reportListQuery(),
|
query: reportListQuery(),
|
||||||
|
variables() {
|
||||||
|
return {}
|
||||||
|
},
|
||||||
|
// Wolle update({ Post }) {
|
||||||
|
// this.setCurrentPosts(Post)
|
||||||
|
// },
|
||||||
fetchPolicy: 'cache-and-network',
|
fetchPolicy: 'cache-and-network',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -249,6 +271,6 @@ export default {
|
|||||||
color: $color-secondary;
|
color: $color-secondary;
|
||||||
}
|
}
|
||||||
.no-decision {
|
.no-decision {
|
||||||
color: $text-color-danger;
|
color: $color-warning;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user