mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Merge pull request #233 from Human-Connection/get_rid_of_resource_type
Update ReportModal to work with back end
This commit is contained in:
commit
6e003d428b
@ -19,7 +19,7 @@
|
||||
</transition>
|
||||
|
||||
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||
<p v-html="$t(`report.${data.context}.message`, { name: name })" />
|
||||
<p v-html="message" />
|
||||
|
||||
<template
|
||||
slot="footer"
|
||||
@ -67,8 +67,13 @@ export default {
|
||||
return this.$store.getters['modal/data'] || {}
|
||||
},
|
||||
title() {
|
||||
if (!this.data.context) return ''
|
||||
return this.$t(`report.${this.data.context}.title`)
|
||||
},
|
||||
message() {
|
||||
if (!this.data.context) return ''
|
||||
return this.$t(`report.${this.data.context}.message`, { name: this.name })
|
||||
},
|
||||
name() {
|
||||
return this.$filters.truncate(this.data.name, 30)
|
||||
},
|
||||
@ -90,24 +95,19 @@ export default {
|
||||
this.$store.commit('modal/SET_OPEN', {})
|
||||
},
|
||||
report() {
|
||||
console.log('')
|
||||
this.loading = true
|
||||
this.disabled = true
|
||||
this.$apollo
|
||||
.mutate({
|
||||
mutation: gql`
|
||||
mutation($id: ID!, $type: ResourceEnum!, $description: String) {
|
||||
report(
|
||||
resource: { id: $id, type: $type }
|
||||
description: $description
|
||||
) {
|
||||
mutation($id: ID!, $description: String) {
|
||||
report(id: $id, description: $description) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`,
|
||||
variables: {
|
||||
id: this.data.id,
|
||||
type: this.data.context,
|
||||
description: '-'
|
||||
}
|
||||
})
|
||||
|
||||
@ -20,7 +20,7 @@ Feature: Tags and Categories
|
||||
|
||||
Scenario: See an overview of categories
|
||||
When I navigate to the administration dashboard
|
||||
And I click on "Categories"
|
||||
And I click on the menu item "Categories"
|
||||
Then I can see a list of categories ordered by post count:
|
||||
| Icon | Name | Posts |
|
||||
| | Just For Fun | 2 |
|
||||
@ -29,7 +29,7 @@ Feature: Tags and Categories
|
||||
|
||||
Scenario: See an overview of tags
|
||||
When I navigate to the administration dashboard
|
||||
And I click on "Tags"
|
||||
And I click on the menu item "Tags"
|
||||
Then I can see a list of tags ordered by user count:
|
||||
| # | Name | Users | Posts |
|
||||
| 1 | Democracy | 2 | 3 |
|
||||
|
||||
@ -15,7 +15,7 @@ Feature: Report and Moderate
|
||||
Scenario Outline: Report a post from various pages
|
||||
Given I am logged in with a "user" role
|
||||
When I see David Irving's post on the <Page>
|
||||
And I click on "Report Contribution" from the triple dot menu of the post
|
||||
And I click on "Report Post" from the triple dot menu of the post
|
||||
And I confirm the reporting dialog because it is a criminal act under German law:
|
||||
"""
|
||||
Do you really want to report the contribution "The Truth about the Holocaust"?
|
||||
|
||||
@ -39,18 +39,15 @@ Given('I am logged in with a {string} role', role => {
|
||||
})
|
||||
})
|
||||
|
||||
When(
|
||||
'I click on "Report Contribution" from the triple dot menu of the post',
|
||||
() => {
|
||||
cy.contains('.ds-card', davidIrvingPostTitle)
|
||||
.find('.content-menu-trigger')
|
||||
.click()
|
||||
When('I click on "Report Post" from the triple dot menu of the post', () => {
|
||||
cy.contains('.ds-card', davidIrvingPostTitle)
|
||||
.find('.content-menu-trigger')
|
||||
.click()
|
||||
|
||||
cy.get('.popover .ds-menu-item-link')
|
||||
.contains('Report Contribution')
|
||||
.click()
|
||||
}
|
||||
)
|
||||
cy.get('.popover .ds-menu-item-link')
|
||||
.contains('Report Post')
|
||||
.click()
|
||||
})
|
||||
|
||||
When(
|
||||
'I click on "Report User" from the triple dot menu in the user info box',
|
||||
@ -122,16 +119,16 @@ When(/^I confirm the reporting dialog .*:$/, message => {
|
||||
|
||||
Given('somebody reported the following posts:', table => {
|
||||
table.hashes().forEach(({ id }) => {
|
||||
const reporter = {
|
||||
email: `reporter${id}@example.org`,
|
||||
const submitter = {
|
||||
email: `submitter${id}@example.org`,
|
||||
password: '1234'
|
||||
}
|
||||
cy.factory()
|
||||
.create('User', reporter)
|
||||
.authenticateAs(reporter)
|
||||
.create('User', submitter)
|
||||
.authenticateAs(submitter)
|
||||
.create('Report', {
|
||||
description: "I don't like this post",
|
||||
resource: { id, type: 'contribution' }
|
||||
id,
|
||||
description: 'Offensive content'
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -146,6 +146,10 @@ When(`I click on {string}`, linkOrButton => {
|
||||
cy.contains(linkOrButton).click()
|
||||
})
|
||||
|
||||
When(`I click on the menu item {string}`, linkOrButton => {
|
||||
cy.contains('.ds-menu-item', linkOrButton).click()
|
||||
})
|
||||
|
||||
When('I press {string}', label => {
|
||||
cy.contains(label).click()
|
||||
})
|
||||
|
||||
@ -8,7 +8,7 @@ export default app => {
|
||||
description
|
||||
type
|
||||
createdAt
|
||||
reporter {
|
||||
submitter {
|
||||
name
|
||||
slug
|
||||
}
|
||||
@ -27,7 +27,7 @@ export default app => {
|
||||
slug
|
||||
}
|
||||
}
|
||||
contribution {
|
||||
post {
|
||||
title
|
||||
slug
|
||||
author {
|
||||
|
||||
@ -131,7 +131,7 @@
|
||||
"reports": {
|
||||
"empty": "Glückwunsch, es gibt nichts zu moderieren.",
|
||||
"name": "Meldungen",
|
||||
"reporter": "gemeldet von"
|
||||
"submitter": "gemeldet von"
|
||||
}
|
||||
},
|
||||
"disable": {
|
||||
|
||||
@ -131,7 +131,7 @@
|
||||
"reports": {
|
||||
"empty": "Congratulations, nothing to moderate.",
|
||||
"name": "Reports",
|
||||
"reporter": "reported by"
|
||||
"submitter": "reported by"
|
||||
}
|
||||
},
|
||||
"disable": {
|
||||
@ -160,7 +160,7 @@
|
||||
"message": "Do you really want to report the user \"<b>{name}</b>\"?"
|
||||
},
|
||||
"contribution": {
|
||||
"title": "Report Contribution",
|
||||
"title": "Report Post",
|
||||
"type": "Contribution",
|
||||
"message": "Do you really want to report the contribution \"<b>{name}</b>\"?"
|
||||
},
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@human-connection/styleguide": "~0.5.2",
|
||||
"@nuxtjs/apollo": "4.0.0-rc4",
|
||||
"@nuxtjs/axios": "~5.4.1",
|
||||
"@nuxtjs/dotenv": "~1.3.0",
|
||||
@ -43,6 +44,7 @@
|
||||
"apollo-client": "~2.5.1",
|
||||
"cookie-universal-nuxt": "~2.0.14",
|
||||
"cross-env": "~5.2.0",
|
||||
"cypress": "^3.1.5",
|
||||
"date-fns": "2.0.0-alpha.27",
|
||||
"express": "~4.16.4",
|
||||
"graphql": "~14.1.1",
|
||||
@ -51,12 +53,11 @@
|
||||
"nuxt": "~2.4.5",
|
||||
"nuxt-env": "~0.1.0",
|
||||
"portal-vue": "~1.5.1",
|
||||
"@human-connection/styleguide": "~0.5.2",
|
||||
"v-tooltip": "~2.0.0-rc.33",
|
||||
"vue-count-to": "~1.0.13",
|
||||
"string-hash": "^1.1.3",
|
||||
"tiptap": "^1.14.0",
|
||||
"tiptap-extensions": "^1.14.0",
|
||||
"v-tooltip": "~2.0.0-rc.33",
|
||||
"vue-count-to": "~1.0.13",
|
||||
"vue-izitoast": "1.1.2",
|
||||
"vue-sweetalert-icons": "~3.2.0",
|
||||
"vuex-i18n": "~1.11.0"
|
||||
|
||||
@ -13,18 +13,18 @@
|
||||
slot="name"
|
||||
slot-scope="scope"
|
||||
>
|
||||
<div v-if="scope.row.type === 'contribution'">
|
||||
<nuxt-link :to="{ name: 'post-slug', params: { slug: scope.row.contribution.slug } }">
|
||||
<b>{{ scope.row.contribution.title | truncate(50) }}</b>
|
||||
<div v-if="scope.row.type === 'Post'">
|
||||
<nuxt-link :to="{ name: 'post-slug', params: { slug: scope.row.post.slug } }">
|
||||
<b>{{ scope.row.post.title | truncate(50) }}</b>
|
||||
</nuxt-link><br>
|
||||
<ds-text
|
||||
size="small"
|
||||
color="soft"
|
||||
>
|
||||
{{ scope.row.contribution.author.name }}
|
||||
{{ scope.row.post.author.name }}
|
||||
</ds-text>
|
||||
</div>
|
||||
<div v-else-if="scope.row.type === 'comment'">
|
||||
<div v-else-if="scope.row.type === 'Comment'">
|
||||
<nuxt-link :to="{ name: 'post-slug', params: { slug: scope.row.comment.post.slug } }">
|
||||
<b>{{ scope.row.comment.contentExcerpt | truncate(50) }}</b>
|
||||
</nuxt-link><br>
|
||||
@ -49,28 +49,28 @@
|
||||
color="soft"
|
||||
>
|
||||
<ds-icon
|
||||
v-if="scope.row.type === 'contribution'"
|
||||
v-tooltip="{ content: $t(`report.${scope.row.type}.type`), placement: 'right' }"
|
||||
v-if="scope.row.type === 'Post'"
|
||||
v-tooltip="{ content: $t('report.contribution.type'), placement: 'right' }"
|
||||
name="bookmark"
|
||||
/>
|
||||
<ds-icon
|
||||
v-else-if="scope.row.type === 'comment'"
|
||||
v-tooltip="{ content: $t(`report.${scope.row.type}.type`), placement: 'right' }"
|
||||
v-else-if="scope.row.type === 'Comment'"
|
||||
v-tooltip="{ content: $t('report.comment.type'), placement: 'right' }"
|
||||
name="comments"
|
||||
/>
|
||||
<ds-icon
|
||||
v-else
|
||||
v-tooltip="{ content: $t(`report.${scope.row.type}.type`), placement: 'right' }"
|
||||
v-else-if="scope.row.type === 'User'"
|
||||
v-tooltip="{ content: $t('report.user.type'), placement: 'right' }"
|
||||
name="user"
|
||||
/>
|
||||
</ds-text>
|
||||
</template>
|
||||
<template
|
||||
slot="reporter"
|
||||
slot="submitter"
|
||||
slot-scope="scope"
|
||||
>
|
||||
<nuxt-link :to="{ name: 'profile-slug', params: { slug: scope.row.reporter.slug } }">
|
||||
{{ scope.row.reporter.name }}
|
||||
<nuxt-link :to="{ name: 'profile-slug', params: { slug: scope.row.submitter.slug } }">
|
||||
{{ scope.row.submitter.name }}
|
||||
</nuxt-link>
|
||||
</template>
|
||||
</ds-table>
|
||||
@ -101,7 +101,7 @@ export default {
|
||||
return {
|
||||
type: ' ',
|
||||
name: ' ',
|
||||
reporter: this.$t('moderation.reports.reporter')
|
||||
submitter: this.$t('moderation.reports.submitter')
|
||||
// actions: ' '
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user