Import report reason categories from a shared array

This commit is contained in:
Wolfgang Huß 2019-10-14 15:20:51 +02:00
parent 663cfeb0b2
commit 2cf2f2b011
2 changed files with 17 additions and 10 deletions

View File

@ -0,0 +1,12 @@
export const reportReasonCategoriesDatabaseList = () => {
return [
'other', // element # zero, because it is the nutral one
'discrimination-etc',
'pornographic-content-links',
'glorific-trivia-of-cruel-inhuman-acts',
'doxing',
'intentional-intimidation-stalking-persecution',
'advert-products-services-commercial',
'criminal-behavior-violation-german-law',
]
}

View File

@ -50,6 +50,7 @@
<script> <script>
import { SweetalertIcon } from 'vue-sweetalert-icons' import { SweetalertIcon } from 'vue-sweetalert-icons'
import { reportMutation } from '~/graphql/Moderation.js' import { reportMutation } from '~/graphql/Moderation.js'
import { reportReasonCategoriesDatabaseList } from '~/../shared/moderation/report.js'
export default { export default {
name: 'ReportModal', name: 'ReportModal',
@ -62,16 +63,10 @@ export default {
id: { type: String, required: true }, id: { type: String, required: true },
}, },
data() { data() {
const valuesReasonCategoryOptions = [ const reasonCategoryList = reportReasonCategoriesDatabaseList()
'discrimination-etc', // move the first element "other" to the end
'pornographic-content-links', let valuesReasonCategoryOptions = reasonCategoryList.slice(1).concat(reasonCategoryList[0])
'glorific-trivia-of-cruel-inhuman-acts',
'doxing',
'intentional-intimidation-stalking-persecution',
'advert-products-services-commercial',
'criminal-behavior-violation-german-law',
'other',
]
let reasonCategoryOptions = [] let reasonCategoryOptions = []
valuesReasonCategoryOptions.forEach(reasonCategory => { valuesReasonCategoryOptions.forEach(reasonCategory => {
reasonCategoryOptions.push({ reasonCategoryOptions.push({