From f7aeb3c61673a706fcc1b82af96630b0c6403d1e Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 25 Nov 2019 11:23:57 +0100 Subject: [PATCH 01/42] added checkbox for blure Images in contribution form --- .../ContributionForm/ContributionForm.spec.js | 8 ++ .../ContributionForm/ContributionForm.vue | 69 ++++++++++++++++++ .../checkbox-set-blank-checked-line.png | Bin 0 -> 1742 bytes 3 files changed, 77 insertions(+) create mode 100644 webapp/static/img/checkbox/checkbox-set-blank-checked-line.png diff --git a/webapp/components/ContributionForm/ContributionForm.spec.js b/webapp/components/ContributionForm/ContributionForm.spec.js index 52f77b3f2..185e9ad56 100644 --- a/webapp/components/ContributionForm/ContributionForm.spec.js +++ b/webapp/components/ContributionForm/ContributionForm.spec.js @@ -245,6 +245,14 @@ describe('ContributionForm.vue', () => { expect(mocks.$apollo.mutate).toHaveBeenCalledTimes(1) }) + describe('questionable images should be blurred', () => { + + it('questionable images unset be blurred', async () => { + await wrapper.find('input[type="checkbox"]').trigger('click') + expect(wrapper.find('input[type="checkbox"]').exists()).toBe(true) + }) + }) + it("pushes the user to the post's page", async () => { wrapper.find('form').trigger('submit') await mocks.$apollo.mutate diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index 734e3be81..aa74b498c 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -79,6 +79,28 @@ + + + + +
+ + + Bilder werden Verschwommen dargestellt + + + +
+
+
diff --git a/webapp/static/img/checkbox/checkbox-set-blank-checked-line.png b/webapp/static/img/checkbox/checkbox-set-blank-checked-line.png new file mode 100644 index 0000000000000000000000000000000000000000..5411a44368d8dd45fc4fc6efb4883ac0a058f96a GIT binary patch literal 1742 zcmeHG`)kc%7=LDEtc>4?c0`HNEPGp0b{fVk9GaCa*Ra?9(jm98<<{Dw!-Ss3Bz`cL z9l6%TC_lJ7R@iYlcA+rRvBb{YAD{R87x>8!^49tGea`bdpXc-WJny$+dLXw~a{pu^ z>XkPsC!Z)`CEm~WNW^nWc55G^M4CROU;;uSLu84VNQl%$#*ndOn2eB7m$ZhgCCg-m zth!n@#Fm(eg;-sy7!pguBtoJH(&qi!rBYmH@N z#aMMLkYsC^4U1uQq);o?2pbV23XW(sYK^i{F^Z{R4KR=fOVC0NgMkfbV4+!^AQ$7X zwPLM0eHe>~*|JzxCl@S`6t*H(6zV|=wN}}xScN?J0h;KB9ncRFPzcrl18J~CDR^Ko zumKG$bBX^L^tdJCkTc@ zum%`NqZ72i1A~DLXmu-c)kq`8QEUuGLLbH=5>>ZAZ~cyiw^6rGZ%K}n=et|4XQkul zx#PC&33ik{4Q}}!EvLYn1ZZ3bYzgK;lQ+t{iGTf3ym?D1J`P%!AD96e|K#~oQwQAP zWvK1BW>V2wqLf?imvCTs$^fEnOY(BY7Hm8mi;fLE&!+4L%|p9BZrw7lt^9pc#j(uF zgpw1#Mtp0n+}M3*>ELR98K2l550`DzyT{`hE%WZ*`@Xx_-|xu5j?!WC3YVuRWp;Eu z|Lk8_pSq{@weQ^Hn$<~1n>y19{be7QuB)%jdQnv3@AouPG!AX6e}(nx%JGZCSR~F zem*VI-Znh-Qu*N@E2f1y->fRCjqkm%p(^)7s5)L9-O=bD@}#+|rL;0SzEP)U#JYZ> z?Rq?;<1$_r^geenwz^^Nm4=_ARxBR%=yc1o`#0Y{m~|uMYp=>p3Y7(Xy{DxenVj;h zvH8%c-9A{u_Uxgg*cP literal 0 HcmV?d00001 From 7f3f81822ee563f981034e5d85518d1157320655 Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 28 Nov 2019 20:40:35 +0100 Subject: [PATCH 02/42] blur the image ok. --- backend/src/models/Post.js | 1 + backend/src/schema/resolvers/posts.js | 10 +- backend/src/schema/types/type/Post.gql | 6 +- backend/src/seed/seed-db.js | 32 ++++- .../ContributionForm/ContributionForm.spec.js | 5 +- .../ContributionForm/ContributionForm.vue | 111 +++++++++++------- webapp/components/PostCard/PostCard.vue | 40 ++++++- webapp/components/TeaserImage/TeaserImage.vue | 2 + webapp/graphql/Fragments.js | 1 + webapp/graphql/PostMutations.js | 6 + webapp/locales/de.json | 6 +- webapp/locales/en.json | 4 +- 12 files changed, 168 insertions(+), 56 deletions(-) diff --git a/backend/src/models/Post.js b/backend/src/models/Post.js index 5ac8378c2..2d2a164db 100644 --- a/backend/src/models/Post.js +++ b/backend/src/models/Post.js @@ -45,4 +45,5 @@ module.exports = { default: () => new Date().toISOString(), }, language: { type: 'string', allow: [null] }, + checkedBlur: { type: 'boolean', default: false }, } diff --git a/backend/src/schema/resolvers/posts.js b/backend/src/schema/resolvers/posts.js index ee6a82d42..44558be4d 100644 --- a/backend/src/schema/resolvers/posts.js +++ b/backend/src/schema/resolvers/posts.js @@ -297,7 +297,15 @@ export default { }, Post: { ...Resolver('Post', { - undefinedToNull: ['activityId', 'objectId', 'image', 'language', 'pinnedAt', 'pinned'], + undefinedToNull: [ + 'activityId', + 'objectId', + 'image', + 'language', + 'pinnedAt', + 'pinned', + 'checkedBlur', + ], hasMany: { tags: '-[:TAGGED]->(related:Tag)', categories: '-[:CATEGORIZED]->(related:Category)', diff --git a/backend/src/schema/types/type/Post.gql b/backend/src/schema/types/type/Post.gql index b29ac5386..f24018567 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 + checkedBlur: Boolean } enum _PostOrdering { @@ -127,6 +128,7 @@ type Post { createdAt: String updatedAt: String language: String + checkedBlur: 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 + checkedBlur: Boolean ): Post UpdatePost( id: ID! @@ -195,6 +197,7 @@ type Mutation { visibility: Visibility language: String categoryIds: [ID] + checkedBlur: Boolean ): Post DeletePost(id: ID!): Post AddPostEmotions(to: _PostInput!, data: _EMOTEDInput!): EMOTED @@ -215,6 +218,7 @@ type Query { createdAt: String updatedAt: String language: String + checkedBlur: Boolean first: Int offset: Int orderBy: [_PostOrdering] diff --git a/backend/src/seed/seed-db.js b/backend/src/seed/seed-db.js index 692d95542..1fd819a87 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(), categoryIds: ['cat16'], + checkedBlur: true, }), factory.create('Post', { author: bobDerBaumeister, @@ -359,24 +360,28 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] language: sample(languages), image: faker.image.unsplash.technology(), categoryIds: ['cat1'], + checkedBlur: false, }), factory.create('Post', { author: huey, id: 'p3', language: sample(languages), categoryIds: ['cat3'], + checkedBlur: false, }), factory.create('Post', { author: dewey, id: 'p4', language: sample(languages), categoryIds: ['cat4'], + checkedBlur: false, }), factory.create('Post', { author: louie, id: 'p5', language: sample(languages), categoryIds: ['cat5'], + checkedBlur: false, }), factory.create('Post', { authorId: 'u1', @@ -384,17 +389,20 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] language: sample(languages), image: faker.image.unsplash.buildings(), categoryIds: ['cat6'], + checkedBlur: false, }), factory.create('Post', { author: huey, id: 'p9', language: sample(languages), categoryIds: ['cat9'], + checkedBlur: false, }), factory.create('Post', { author: dewey, id: 'p10', categoryIds: ['cat10'], + checkedBlur: true, }), factory.create('Post', { author: louie, @@ -402,12 +410,14 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] language: sample(languages), image: faker.image.unsplash.people(), categoryIds: ['cat11'], + checkedBlur: false, }), factory.create('Post', { author: bobDerBaumeister, id: 'p13', language: sample(languages), categoryIds: ['cat13'], + checkedBlur: false, }), factory.create('Post', { author: jennyRostock, @@ -415,12 +425,14 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] language: sample(languages), image: faker.image.unsplash.objects(), categoryIds: ['cat14'], + checkedBlur: false, }), factory.create('Post', { author: huey, id: 'p15', language: sample(languages), categoryIds: ['cat15'], + checkedBlur: false, }), ]) @@ -434,8 +446,20 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] const hashtagAndMention1 = 'The new physics of #QuantenFlussTheorie can explain #QuantumGravity! @peter-lustig got that already. ;-)' const createPostMutation = gql` - mutation($id: ID, $title: String!, $content: String!, $categoryIds: [ID]) { - CreatePost(id: $id, title: $title, content: $content, categoryIds: $categoryIds) { + mutation( + $id: ID + $title: String! + $content: String! + $categoryIds: [ID] + $checkedBlur: Boolean + ) { + CreatePost( + id: $id + title: $title + content: $content + categoryIds: $categoryIds + checkedBlur: $checkedBlur + ) { id } } @@ -449,6 +473,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] title: `Nature Philosophy Yoga`, content: hashtag1, categoryIds: ['cat2'], + checkedBlur: false, }, }), mutate({ @@ -458,6 +483,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] title: 'This is post #7', content: `${mention1} ${faker.lorem.paragraph()}`, categoryIds: ['cat7'], + checkedBlur: false, }, }), mutate({ @@ -468,6 +494,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] title: `Quantum Flow Theory explains Quantum Gravity`, content: hashtagAndMention1, categoryIds: ['cat8'], + checkedBlur: false, }, }), mutate({ @@ -477,6 +504,7 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl'] title: 'This is post #12', content: `${mention2} ${faker.lorem.paragraph()}`, categoryIds: ['cat12'], + checkedBlur: false, }, }), ]) diff --git a/webapp/components/ContributionForm/ContributionForm.spec.js b/webapp/components/ContributionForm/ContributionForm.spec.js index 185e9ad56..603724eca 100644 --- a/webapp/components/ContributionForm/ContributionForm.spec.js +++ b/webapp/components/ContributionForm/ContributionForm.spec.js @@ -245,10 +245,9 @@ describe('ContributionForm.vue', () => { expect(mocks.$apollo.mutate).toHaveBeenCalledTimes(1) }) - describe('questionable images should be blurred', () => { - + describe('questionable images should be blurred', () => { it('questionable images unset be blurred', async () => { - await wrapper.find('input[type="checkbox"]').trigger('click') + await wrapper.find('input[type="checkbox"]').trigger('click') expect(wrapper.find('input[type="checkbox"]').exists()).toBe(true) }) }) diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index aa74b498c..98e515766 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -15,6 +15,27 @@ /> + + + + + + + + @@ -78,28 +99,7 @@ - - - - - - - +
this.contribution.language === o.value) : null form.categoryIds = this.categoryIds(this.contribution.categories) + form.checkedBlur = this.contribution.checkedBlur + + // console.log(this.contribution.checkedBlur) + // console.log(this.contribution) } + return { form, formSchema: { @@ -186,6 +193,7 @@ export default { }, }, language: { required: true }, + checkedBlur: { required: false }, }, languageOptions, id, @@ -194,9 +202,13 @@ export default { users: [], contentMin: 3, hashtags: [], - checkedBlur: false, elem: null, - elem1: null, + checkedBlur: false, + } + }, + created() { + if (this.contribution && this.contribution.checkedBlur) { + this.checkedChange() } }, computed: { @@ -209,21 +221,29 @@ export default { }, methods: { checkedChange() { - this.elem = this.$el.querySelector('img') - this.elem1 = this.$el.querySelector('img.thumbnail-preview') + // console.log( 'checkedChange') + // console.log( 'this.checkedBlur old', this.checkedBlur) + // console.log( 'THIS', this.$el) + // console.log( 'THIS.form', this.form) + + if (this.$el) { + this.elem = this.$el.querySelector('img') + } else { + } if (this.checkedBlur) { this.elem.classList.remove('img-blur-in') this.checkedBlur = false + this.form.checkedBlur = false + this.form.checkbox = false } else { if (this.elem != null) { - this.elem.classList.add('img-blur-in') + this.elem.classList.add('img-blur-in') } - if (this.elem1 != null) { - this.elem1.classList.add('img-blur-in') - } - this.checkedBlur = true + this.form.checkedBlur = true + this.form.checkbox = true } + // console.log( 'this.checkedBlur new', this.checkedBlur) }, submit() { const { @@ -246,6 +266,7 @@ export default { language, image, imageUpload: teaserImage, + checkedBlur: this.form.checkbox, }, }) .then(({ data }) => { @@ -307,6 +328,21 @@ export default { } + + diff --git a/webapp/components/PostCard/PostCard.vue b/webapp/components/PostCard/PostCard.vue index e65e17102..78f9f9e95 100644 --- a/webapp/components/PostCard/PostCard.vue +++ b/webapp/components/PostCard/PostCard.vue @@ -2,8 +2,17 @@ + + + + + + diff --git a/webapp/pages/moderation/images.vue b/webapp/pages/moderation/images.vue deleted file mode 100644 index 86e222f0e..000000000 --- a/webapp/pages/moderation/images.vue +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index 769b978b8..7331daf6d 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -12,21 +12,21 @@ > 4?c0`HNEPGp0b{fVk9GaCa*Ra?9(jm98<<{Dw!-Ss3Bz`cL z9l6%TC_lJ7R@iYlcA+rRvBb{YAD{R87x>8!^49tGea`bdpXc-WJny$+dLXw~a{pu^ z>XkPsC!Z)`CEm~WNW^nWc55G^M4CROU;;uSLu84VNQl%$#*ndOn2eB7m$ZhgCCg-m zth!n@#Fm(eg;-sy7!pguBtoJH(&qi!rBYmH@N z#aMMLkYsC^4U1uQq);o?2pbV23XW(sYK^i{F^Z{R4KR=fOVC0NgMkfbV4+!^AQ$7X zwPLM0eHe>~*|JzxCl@S`6t*H(6zV|=wN}}xScN?J0h;KB9ncRFPzcrl18J~CDR^Ko zumKG$bBX^L^tdJCkTc@ zum%`NqZ72i1A~DLXmu-c)kq`8QEUuGLLbH=5>>ZAZ~cyiw^6rGZ%K}n=et|4XQkul zx#PC&33ik{4Q}}!EvLYn1ZZ3bYzgK;lQ+t{iGTf3ym?D1J`P%!AD96e|K#~oQwQAP zWvK1BW>V2wqLf?imvCTs$^fEnOY(BY7Hm8mi;fLE&!+4L%|p9BZrw7lt^9pc#j(uF zgpw1#Mtp0n+}M3*>ELR98K2l550`DzyT{`hE%WZ*`@Xx_-|xu5j?!WC3YVuRWp;Eu z|Lk8_pSq{@weQ^Hn$<~1n>y19{be7QuB)%jdQnv3@AouPG!AX6e}(nx%JGZCSR~F zem*VI-Znh-Qu*N@E2f1y->fRCjqkm%p(^)7s5)L9-O=bD@}#+|rL;0SzEP)U#JYZ> z?Rq?;<1$_r^geenwz^^Nm4=_ARxBR%=yc1o`#0Y{m~|uMYp=>p3Y7(Xy{DxenVj;h zvH8%c-9A{u_Uxgg*cP From 7c26e844637b54f28dee70d1a79d8fb007e590cd Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 4 Dec 2019 15:17:21 +0100 Subject: [PATCH 11/42] rename Blur() to blur() --- webapp/pages/post/_id/_slug/index.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index 7331daf6d..311b95f04 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -23,7 +23,7 @@ class="bluricon-post" icon="eye-slash" primary - @click.prevent="Blur" + @click.prevent="blur" > Date: Wed, 4 Dec 2019 15:23:16 +0100 Subject: [PATCH 12/42] lint fix --- webapp/components/ContributionForm/ContributionForm.spec.js | 1 - webapp/pages/post/_id/_slug/index.vue | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/webapp/components/ContributionForm/ContributionForm.spec.js b/webapp/components/ContributionForm/ContributionForm.spec.js index 889995595..53057a771 100644 --- a/webapp/components/ContributionForm/ContributionForm.spec.js +++ b/webapp/components/ContributionForm/ContributionForm.spec.js @@ -250,7 +250,6 @@ describe('ContributionForm.vue', () => { await wrapper.find('input[type="checkbox"]').trigger('click') expect(wrapper.find('input[type="checkbox"]').exists()).toBe(true) expect(wrapper.find('.images-set-blur').exists()).toBe(true) - }) }) diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index 311b95f04..e0949498a 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -23,7 +23,7 @@ class="bluricon-post" icon="eye-slash" primary - @click.prevent="blur" + @click.prevent="setBlur" > Date: Fri, 6 Dec 2019 09:16:14 +0100 Subject: [PATCH 13/42] fix and changes revies, fix lint --- .../ContributionForm/ContributionForm.spec.js | 1 - .../ContributionForm/ContributionForm.vue | 37 +++++-------------- webapp/components/PostCard/PostCard.vue | 3 +- webapp/pages/post/_id/_slug/index.vue | 32 ++++++++-------- 4 files changed, 26 insertions(+), 47 deletions(-) diff --git a/webapp/components/ContributionForm/ContributionForm.spec.js b/webapp/components/ContributionForm/ContributionForm.spec.js index c8d36459e..c84700106 100644 --- a/webapp/components/ContributionForm/ContributionForm.spec.js +++ b/webapp/components/ContributionForm/ContributionForm.spec.js @@ -249,7 +249,6 @@ describe('ContributionForm.vue', () => { wrapper.find(TeaserImage).vm.$emit('addTeaserImage', imageUpload) expect(wrapper.find('.images-set-blur').exists()).toBe(false) await wrapper.find('input[type="checkbox"]').trigger('click') - expect(wrapper.find('input[type="checkbox"]').exists()).toBe(true) expect(wrapper.find('.images-set-blur').exists()).toBe(true) }) }) diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index 5d6ff1351..f2ec8327e 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -10,7 +10,7 @@ -
- +
+
@@ -45,8 +38,8 @@ class="blurImageCheckbox" type="checkbox" id="blur_img" - v-model="checkedBlur" - @change="form.checkbox = checkedBlur" + v-model="blurImage" + @change="form.checkbox = blurImage" /> @@ -223,13 +216,13 @@ export default { contentMin: 3, hashtags: [], elem: null, - checkedBlur: false, + blurImage: false, } }, created() {}, mounted() { if (this.contribution && this.contribution.blurImage === true) { - this.checkedBlur = true + this.blurImage = true } }, computed: { @@ -242,8 +235,8 @@ export default { }, methods: { unBlur() { - if (this.checkedBlur) { - this.checkedBlur = false + if (this.blurImage) { + this.blurImage = false } }, submit() { @@ -335,18 +328,6 @@ export default { - - - diff --git a/webapp/components/PostCard/PostCard.vue b/webapp/components/PostCard/PostCard.vue index d5e65746b..ad5a68388 100644 --- a/webapp/components/PostCard/PostCard.vue +++ b/webapp/components/PostCard/PostCard.vue @@ -5,8 +5,8 @@ :class="{ 'post-card': true, 'disabled-content': post.disabled, - 'post--pinned': isPinned, - 'images-set-blur': post.blurImage, + '--pinned': isPinned, + '--blur-image': post.blurImage, }" > @@ -157,22 +157,26 @@ export default { }, } - diff --git a/webapp/components/TeaserImage/TeaserImage.vue b/webapp/components/TeaserImage/TeaserImage.vue index fbf230660..c4b8d4b31 100644 --- a/webapp/components/TeaserImage/TeaserImage.vue +++ b/webapp/components/TeaserImage/TeaserImage.vue @@ -142,7 +142,7 @@ export default {