diff --git a/.vscode/settings.json b/.vscode/settings.json index 2091e5e03..8565bda8e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,5 +8,4 @@ } ], "editor.formatOnSave": false, - "eslint.autoFixOnSave": true } diff --git a/backend/src/models/Post.js b/backend/src/models/Post.js index 18dc0e464..bd6eda2e4 100644 --- a/backend/src/models/Post.js +++ b/backend/src/models/Post.js @@ -39,5 +39,6 @@ module.exports = { default: () => new Date().toISOString(), }, language: { type: 'string', allow: [null] }, + imageBlurred: { type: 'boolean', default: false }, imageAspectRatio: { type: 'float', default: 1.0 }, } diff --git a/backend/src/schema/resolvers/posts.js b/backend/src/schema/resolvers/posts.js index 6ae3a81d9..47223faea 100644 --- a/backend/src/schema/resolvers/posts.js +++ b/backend/src/schema/resolvers/posts.js @@ -341,6 +341,7 @@ export default { 'language', 'pinnedAt', 'pinned', + 'imageBlurred', 'imageAspectRatio', ], hasMany: { diff --git a/backend/src/schema/types/type/Post.gql b/backend/src/schema/types/type/Post.gql index 0f1817971..2e4358b3e 100644 --- a/backend/src/schema/types/type/Post.gql +++ b/backend/src/schema/types/type/Post.gql @@ -82,6 +82,7 @@ input _PostFilter { emotions_none: _PostEMOTEDFilter emotions_single: _PostEMOTEDFilter emotions_every: _PostEMOTEDFilter + imageBlurred: Boolean } enum _PostOrdering { @@ -127,6 +128,7 @@ type Post { createdAt: String updatedAt: String language: String + imageBlurred: Boolean pinnedAt: String @cypher( statement: "MATCH (this)<-[pinned:PINNED]-(:User) WHERE NOT this.deleted = true AND NOT this.disabled = true RETURN pinned.createdAt" ) @@ -140,7 +142,6 @@ type Post { LIMIT 10 """ ) - tags: [Tag]! @relation(name: "TAGGED", direction: "OUT") categories: [Category]! @relation(name: "CATEGORIZED", direction: "OUT") @@ -183,6 +184,7 @@ type Mutation { language: String categoryIds: [ID] contentExcerpt: String + imageBlurred: Boolean imageAspectRatio: Float ): Post UpdatePost( @@ -196,6 +198,7 @@ type Mutation { visibility: Visibility language: String categoryIds: [ID] + imageBlurred: Boolean imageAspectRatio: Float ): Post DeletePost(id: ID!): Post @@ -217,6 +220,7 @@ type Query { createdAt: String updatedAt: String language: String + imageBlurred: Boolean first: Int offset: Int orderBy: [_PostOrdering] diff --git a/backend/src/seed/factories/posts.js b/backend/src/seed/factories/posts.js index 2443619ae..d1a46d71b 100644 --- a/backend/src/seed/factories/posts.js +++ b/backend/src/seed/factories/posts.js @@ -19,6 +19,7 @@ export default function create() { visibility: 'public', deleted: false, categoryIds: [], + imageBlurred: false, imageAspectRatio: 1.333, } args = { diff --git a/backend/src/seed/seed-db.js b/backend/src/seed/seed-db.js index 475a7b54f..4178169bb 100644 --- a/backend/src/seed/seed-db.js +++ b/backend/src/seed/seed-db.js @@ -352,6 +352,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] language: sample(languages), image: faker.image.unsplash.food(300, 169), categoryIds: ['cat16'], + imageBlurred: true, imageAspectRatio: 300 / 169, }), factory.create('Post', { @@ -398,6 +399,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] author: dewey, id: 'p10', categoryIds: ['cat10'], + imageBlurred: true, }), factory.create('Post', { author: louie, @@ -444,6 +446,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] $title: String! $content: String! $categoryIds: [ID] + $imageBlurred: Boolean $imageAspectRatio: Float ) { CreatePost( @@ -451,6 +454,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] title: $title content: $content categoryIds: $categoryIds + imageBlurred: $imageBlurred imageAspectRatio: $imageAspectRatio ) { id diff --git a/webapp/components/ContributionForm/ContributionForm.spec.js b/webapp/components/ContributionForm/ContributionForm.spec.js index 8c50f30b6..2f0f2e30d 100644 --- a/webapp/components/ContributionForm/ContributionForm.spec.js +++ b/webapp/components/ContributionForm/ContributionForm.spec.js @@ -200,6 +200,7 @@ describe('ContributionForm.vue', () => { imageUpload: null, imageAspectRatio: null, image: null, + imageBlurred: false, }, } postTitleInput = wrapper.find('.ds-input') diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index eeba47b72..92000edf2 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -10,6 +10,7 @@ + +
+ + +

+ + {{ $t('contribution.inappropriatePictureText') }} + + +

+
+ @@ -80,6 +97,7 @@ +
this.contribution.language === o.value) : null form.categoryIds = this.categoryIds(this.contribution.categories) + form.blurImage = this.contribution.imageBlurred } + return { form, formSchema: { @@ -167,6 +189,7 @@ export default { }, }, language: { required: true }, + blurImage: { required: false }, }, languageOptions, id, @@ -175,6 +198,7 @@ export default { users: [], contentMin: 3, hashtags: [], + elem: null, } }, computed: { @@ -195,6 +219,7 @@ export default { teaserImage, imageAspectRatio, categoryIds, + blurImage, } = this.form this.loading = true this.$apollo @@ -208,6 +233,7 @@ export default { language, image, imageUpload: teaserImage, + imageBlurred: blurImage, imageAspectRatio, }, }) @@ -273,28 +299,35 @@ export default { } - diff --git a/webapp/components/PostCard/PostCard.vue b/webapp/components/PostCard/PostCard.vue index 0a4ced550..f9c1fa325 100644 --- a/webapp/components/PostCard/PostCard.vue +++ b/webapp/components/PostCard/PostCard.vue @@ -2,7 +2,12 @@ - - diff --git a/webapp/components/TeaserImage/TeaserImage.vue b/webapp/components/TeaserImage/TeaserImage.vue index 95d94d70f..a08b9e0ef 100644 --- a/webapp/components/TeaserImage/TeaserImage.vue +++ b/webapp/components/TeaserImage/TeaserImage.vue @@ -140,7 +140,7 @@ export default {