Update ReportModal to work with back end

This commit is contained in:
Matt Rider 2019-03-07 20:59:13 -03:00
parent d848929302
commit 842d68c129
6 changed files with 635 additions and 52 deletions

View File

@ -90,24 +90,19 @@ export default {
this.$store.commit('modal/SET_OPEN', {}) this.$store.commit('modal/SET_OPEN', {})
}, },
report() { report() {
console.log('')
this.loading = true this.loading = true
this.disabled = true this.disabled = true
this.$apollo this.$apollo
.mutate({ .mutate({
mutation: gql` mutation: gql`
mutation($id: ID!, $type: ResourceEnum!, $description: String) { mutation($id: ID!, $description: String) {
report( report(id: $id, description: $description) {
resource: { id: $id, type: $type }
description: $description
) {
id id
} }
} }
`, `,
variables: { variables: {
id: this.data.id, id: this.data.id,
type: this.data.context,
description: '-' description: '-'
} }
}) })

View File

@ -15,7 +15,7 @@ Feature: Report and Moderate
Scenario Outline: Report a post from various pages Scenario Outline: Report a post from various pages
Given I am logged in with a "user" role Given I am logged in with a "user" role
When I see David Irving's post on the <Page> 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: 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"? Do you really want to report the contribution "The Truth about the Holocaust"?

View File

@ -39,18 +39,15 @@ Given('I am logged in with a {string} role', role => {
}) })
}) })
When( When('I click on "Report Post" from the triple dot menu of the post', () => {
'I click on "Report Contribution" from the triple dot menu of the post',
() => {
cy.contains('.ds-card', davidIrvingPostTitle) cy.contains('.ds-card', davidIrvingPostTitle)
.find('.content-menu-trigger') .find('.content-menu-trigger')
.click() .click()
cy.get('.popover .ds-menu-item-link') cy.get('.popover .ds-menu-item-link')
.contains('Report Contribution') .contains('Report Post')
.click() .click()
} })
)
When( When(
'I click on "Report User" from the triple dot menu in the user info box', '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 => { Given('somebody reported the following posts:', table => {
table.hashes().forEach(({ id }) => { table.hashes().forEach(({ id }) => {
const reporter = { const submitter = {
email: `reporter${id}@example.org`, email: `submitter${id}@example.org`,
password: '1234' password: '1234'
} }
cy.factory() cy.factory()
.create('User', reporter) .create('User', submitter)
.authenticateAs(reporter) .authenticateAs(submitter)
.create('Report', { .create('Report', {
description: "I don't like this post", id,
resource: { id, type: 'contribution' } description: "Offensive content"
}) })
}) })
}) })

View File

@ -144,7 +144,7 @@
"message": "Do you really want to report the user \"<b>{name}</b>\"?" "message": "Do you really want to report the user \"<b>{name}</b>\"?"
}, },
"contribution": { "contribution": {
"title": "Report Contribution", "title": "Report Post",
"type": "Contribution", "type": "Contribution",
"message": "Do you really want to report the contribution \"<b>{name}</b>\"?" "message": "Do you really want to report the contribution \"<b>{name}</b>\"?"
}, },

View File

@ -34,6 +34,7 @@
} }
}, },
"dependencies": { "dependencies": {
"@human-connection/styleguide": "~0.5.2",
"@nuxtjs/apollo": "4.0.0-rc4", "@nuxtjs/apollo": "4.0.0-rc4",
"@nuxtjs/axios": "~5.4.1", "@nuxtjs/axios": "~5.4.1",
"@nuxtjs/dotenv": "~1.3.0", "@nuxtjs/dotenv": "~1.3.0",
@ -43,6 +44,7 @@
"apollo-client": "~2.5.1", "apollo-client": "~2.5.1",
"cookie-universal-nuxt": "~2.0.14", "cookie-universal-nuxt": "~2.0.14",
"cross-env": "~5.2.0", "cross-env": "~5.2.0",
"cypress": "^3.1.5",
"date-fns": "2.0.0-alpha.27", "date-fns": "2.0.0-alpha.27",
"express": "~4.16.4", "express": "~4.16.4",
"graphql": "~14.1.1", "graphql": "~14.1.1",
@ -51,12 +53,11 @@
"nuxt": "~2.4.5", "nuxt": "~2.4.5",
"nuxt-env": "~0.1.0", "nuxt-env": "~0.1.0",
"portal-vue": "~1.5.1", "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", "string-hash": "^1.1.3",
"tiptap": "^1.13.0", "tiptap": "^1.13.0",
"tiptap-extensions": "^1.13.0", "tiptap-extensions": "^1.13.0",
"v-tooltip": "~2.0.0-rc.33",
"vue-count-to": "~1.0.13",
"vue-izitoast": "1.1.2", "vue-izitoast": "1.1.2",
"vue-sweetalert-icons": "~3.2.0", "vue-sweetalert-icons": "~3.2.0",
"vuex-i18n": "~1.11.0" "vuex-i18n": "~1.11.0"

636
yarn.lock

File diff suppressed because it is too large Load Diff