Merge branch 'master' of github.com:Human-Connection/Nitro-Web into 37-full-text-search-top-bar

This commit is contained in:
Matt Rider 2019-03-12 12:49:48 -03:00
commit 85ffd67a49
10 changed files with 50 additions and 72 deletions

View File

@ -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: '-'
}
})

View File

@ -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 |

View File

@ -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"?

View File

@ -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'
})
})
})

View File

@ -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()
})

View File

@ -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 {

View File

@ -136,7 +136,7 @@
"reports": {
"empty": "Glückwunsch, es gibt nichts zu moderieren.",
"name": "Meldungen",
"reporter": "gemeldet von"
"submitter": "gemeldet von"
}
},
"disable": {

View File

@ -136,7 +136,7 @@
"reports": {
"empty": "Congratulations, nothing to moderate.",
"name": "Reports",
"reporter": "reported by"
"submitter": "reported by"
}
},
"disable": {
@ -165,7 +165,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>\"?"
},

View File

@ -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: ' '
}
}

View File

@ -2499,17 +2499,7 @@ babel-eslint@~10.0.1:
eslint-scope "3.7.1"
eslint-visitor-keys "^1.0.0"
babel-jest@^24.1.0:
version "24.1.0"
resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.1.0.tgz#441e23ef75ded3bd547e300ac3194cef87b55190"
integrity sha512-MLcagnVrO9ybQGLEfZUqnOzv36iQzU7Bj4elm39vCukumLVSfoX+tRy3/jW7lUKc7XdpRmB/jech6L/UCsSZjw==
dependencies:
babel-plugin-istanbul "^5.1.0"
babel-preset-jest "^24.1.0"
chalk "^2.4.2"
slash "^2.0.0"
babel-jest@~24.3.1:
babel-jest@^24.1.0, babel-jest@~24.3.1:
version "24.3.1"
resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.3.1.tgz#168468a37e90426520c5293da4f55e1a512063b0"
integrity sha512-6KaXyUevY0KAxD5Ba+EBhyfwvc+R2f7JV7BpBZ5T8yJGgj0M1hYDfRhDq35oD5MzprMf/ggT81nEuLtMyxfDIg==
@ -2555,11 +2545,6 @@ babel-plugin-istanbul@^5.1.0:
istanbul-lib-instrument "^3.0.0"
test-exclude "^5.0.0"
babel-plugin-jest-hoist@^24.1.0:
version "24.1.0"
resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.1.0.tgz#dfecc491fb15e2668abbd690a697a8fd1411a7f8"
integrity sha512-gljYrZz8w1b6fJzKcsfKsipSru2DU2DmQ39aB6nV3xQ0DDv3zpIzKGortA5gknrhNnPN8DweaEgrnZdmbGmhnw==
babel-plugin-jest-hoist@^24.3.0:
version "24.3.0"
resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.3.0.tgz#f2e82952946f6e40bb0a75d266a3790d854c8b5b"
@ -2585,14 +2570,6 @@ babel-plugin-transform-strict-mode@^6.24.1:
babel-runtime "^6.22.0"
babel-types "^6.24.1"
babel-preset-jest@^24.1.0:
version "24.1.0"
resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.1.0.tgz#83bc564fdcd4903641af65ec63f2f5de6b04132e"
integrity sha512-FfNLDxFWsNX9lUmtwY7NheGlANnagvxq8LZdl5PKnVG3umP+S/g0XbVBfwtA4Ai3Ri/IMkWabBz3Tyk9wdspcw==
dependencies:
"@babel/plugin-syntax-object-rest-spread" "^7.0.0"
babel-plugin-jest-hoist "^24.1.0"
babel-preset-jest@^24.3.0:
version "24.3.0"
resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.3.0.tgz#db88497e18869f15b24d9c0e547d8e0ab950796d"