From dcb4196a1a8b59079eeb34f47ef5deb5d7bff034 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 29 Oct 2019 23:52:50 +0100 Subject: [PATCH 01/93] Fix #2042 Back Link To Login Page --- webapp/components/Registration/Signup.vue | 296 +++++++++++----------- 1 file changed, 152 insertions(+), 144 deletions(-) diff --git a/webapp/components/Registration/Signup.vue b/webapp/components/Registration/Signup.vue index 00309b1c6..cc1b661f3 100644 --- a/webapp/components/Registration/Signup.vue +++ b/webapp/components/Registration/Signup.vue @@ -1,152 +1,160 @@ + From c8ce53d598fd54a521641472fa42129c68f7921e Mon Sep 17 00:00:00 2001 From: Joseph Ngugi Date: Thu, 31 Oct 2019 21:21:31 +0300 Subject: [PATCH 02/93] add allowShouts field --- backend/src/models/User.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/src/models/User.js b/backend/src/models/User.js index b24148f00..31c74bb2f 100644 --- a/backend/src/models/User.js +++ b/backend/src/models/User.js @@ -127,6 +127,10 @@ module.exports = { type: 'boolean', default: false, }, + allowShouts: { + type: 'boolean', + default: false, + }, locale: { type: 'string', allow: [null], From 96683512799fb68072e303c3a43b8bb3b1cf80e4 Mon Sep 17 00:00:00 2001 From: Joseph Ngugi Date: Thu, 31 Oct 2019 21:22:10 +0300 Subject: [PATCH 03/93] add allowShouts type --- backend/src/schema/types/type/User.gql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/src/schema/types/type/User.gql b/backend/src/schema/types/type/User.gql index cce0df058..01ba3054a 100644 --- a/backend/src/schema/types/type/User.gql +++ b/backend/src/schema/types/type/User.gql @@ -28,6 +28,7 @@ type User { termsAndConditionsAgreedAt: String allowEmbedIframes: Boolean + allowShouts: Boolean locale: String friends: [User]! @relation(name: "FRIENDS", direction: "BOTH") friendsCount: Int! @cypher(statement: "MATCH (this)<-[: FRIENDS]->(r: User) RETURN COUNT(DISTINCT r)") @@ -170,6 +171,8 @@ type Mutation { termsAndConditionsAgreedVersion: String termsAndConditionsAgreedAt: String allowEmbedIframes: Boolean + allowShouts: Boolean + locale: String ): User From 044155a298f4698c41e41b59e71676d10b5ea51f Mon Sep 17 00:00:00 2001 From: Joseph Ngugi Date: Thu, 31 Oct 2019 21:22:44 +0300 Subject: [PATCH 04/93] add allowShouts mutation --- backend/src/seed/factories/users.js | 1 + webapp/graphql/User.js | 11 +++++++++++ webapp/store/auth.js | 1 + 3 files changed, 13 insertions(+) diff --git a/backend/src/seed/factories/users.js b/backend/src/seed/factories/users.js index 99e2681c9..f56f759f1 100644 --- a/backend/src/seed/factories/users.js +++ b/backend/src/seed/factories/users.js @@ -17,6 +17,7 @@ export default function create() { termsAndConditionsAgreedVersion: '0.0.1', termsAndConditionsAgreedAt: '2019-08-01T10:47:19.212Z', allowEmbedIframes: false, + allowShouts: false, locale: 'en', } defaults.slug = slugify(defaults.name, { lower: true }) diff --git a/webapp/graphql/User.js b/webapp/graphql/User.js index e82280689..7fbd513aa 100644 --- a/webapp/graphql/User.js +++ b/webapp/graphql/User.js @@ -146,6 +146,17 @@ export const allowEmbedIframesMutation = () => { ` } +export const allowShoutsMutation = () => { + return gql` + mutation($id: ID!, $allowShouts: Boolean) { + UpdateUser(id: $id, allowShouts: $allowShouts) { + id + allowShouts + } + } + ` +} + export const checkSlugAvailableQuery = gql` query($slug: String!) { User(slug: $slug) { diff --git a/webapp/store/auth.js b/webapp/store/auth.js index 90c59a8f5..026c8be64 100644 --- a/webapp/store/auth.js +++ b/webapp/store/auth.js @@ -87,6 +87,7 @@ export const actions = { contributionsCount commentedCount allowEmbedIframes + allowShouts termsAndConditionsAgreedVersion socialMedia { id From f9212446614f52ab402d8b6030ce0e58f99c54e3 Mon Sep 17 00:00:00 2001 From: Marco Bomfim Date: Wed, 6 Nov 2019 16:24:48 -0300 Subject: [PATCH 05/93] fix(editor): Fix hashtags not working after embeded content Up to this point, once you've inserted a given URL to the editor, and it renders a new embeded content, if you hit Return, and try using a tag, or mention, it would not work since the paragraph was never closed, causing a sintatic error that rendered the mentions unable to be used unless you explicitly hit return again, to escape the given text block you were in. See the PR/Issue for further info. --- .../Editor/defaultExtensions.spec.js | 28 ++++++++----------- webapp/components/Editor/nodes/Embed.js | 4 +-- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/webapp/components/Editor/defaultExtensions.spec.js b/webapp/components/Editor/defaultExtensions.spec.js index 78924db55..55cb861d8 100644 --- a/webapp/components/Editor/defaultExtensions.spec.js +++ b/webapp/components/Editor/defaultExtensions.spec.js @@ -63,30 +63,26 @@ describe('defaultExtensions', () => { it('recognizes embed code', () => { const editor = createEditor() const expected = { + type: 'doc', content: [ { + type: 'paragraph', content: [ { text: 'Baby loves cat:', - type: 'text', - }, - ], - type: 'paragraph', + type: 'text' + } + ] }, { - content: [ - { - attrs: { - dataEmbedUrl: 'https://www.youtube.com/watch?v=qkdXAtO40Fo', - }, - type: 'embed', - }, - ], - type: 'paragraph', - }, - ], - type: 'doc', + type: 'embed', + attrs: { + dataEmbedUrl: 'https://www.youtube.com/watch?v=qkdXAtO40Fo' + } + } + ] } + expect(editor.getJSON()).toEqual(expected) }) }) diff --git a/webapp/components/Editor/nodes/Embed.js b/webapp/components/Editor/nodes/Embed.js index 0d7a82a18..e84b717e2 100644 --- a/webapp/components/Editor/nodes/Embed.js +++ b/webapp/components/Editor/nodes/Embed.js @@ -38,8 +38,8 @@ export default class Embed extends Node { default: null, }, }, - group: 'inline', - inline: true, + group: 'block', + inline: false, parseDOM: [ { tag: 'a[href].embed', From 96801bb54fdd45caa344db62adee8d951d3545a3 Mon Sep 17 00:00:00 2001 From: Marco Bomfim Date: Wed, 6 Nov 2019 16:49:34 -0300 Subject: [PATCH 06/93] fix(editor): Fix embed thumbnail height --- webapp/components/Editor/Editor.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/webapp/components/Editor/Editor.vue b/webapp/components/Editor/Editor.vue index fa37c64dc..234d94d2d 100644 --- a/webapp/components/Editor/Editor.vue +++ b/webapp/components/Editor/Editor.vue @@ -377,6 +377,7 @@ li > p { .embed-preview-image { width: 100%; height: auto; + max-height: 450px; } .embed-preview-image--clickable { From b76354d95d23562e832f0a3ffe3d36aa94430bbb Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 7 Nov 2019 09:12:13 +0100 Subject: [PATCH 07/93] 2119-Fix consistent form input validation --- .../ContributionForm/ContributionForm.vue | 59 +++++++++++++++++-- 1 file changed, 53 insertions(+), 6 deletions(-) diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index eb849c71f..e27730584 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -21,7 +21,26 @@ name="title" autofocus /> - {{ form.title.length }}/{{ formSchema.title.max }} + + + {{ form.title.length }}/{{ formSchema.title.max }} + + + + {{ form.title.length }}/{{ formSchema.title.max }} + + + + {{ form.title.length }}/{{ formSchema.title.max }} + + + + - {{ form.contentLength }} + + {{ form.contentLength }} + + + + + + + @@ -113,7 +156,7 @@ export default { }, formSchema: { title: { required: true, min: 3, max: 100 }, - content: [{ required: true }], + content: { required: true, min: 3 }, }, id: null, loading: false, @@ -204,9 +247,7 @@ export default { this.manageContent(value) }, manageContent(content) { - // filter HTML out of content value - const str = content.replace(/<\/?[^>]+(>|$)/gm, '') - // Set counter length of text + let str = content.replace(/<\/?[^>]+(>|$)/gm, '') this.form.contentLength = str.length this.validatePost() }, @@ -288,4 +329,10 @@ export default { padding-right: 0; } } +.checkicon { + top: -18px; +} +.checkicon_cat { + top: -38px; +} From 32c5ea1d52bffa60995dd389587097a11fd334c6 Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 7 Nov 2019 09:23:00 +0100 Subject: [PATCH 08/93] fix category if fail, fix lint --- webapp/components/ContributionForm/ContributionForm.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index e27730584..1ba254aac 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -40,7 +40,6 @@ - Date: Thu, 7 Nov 2019 11:39:07 +0100 Subject: [PATCH 09/93] fix css - checkbutton cursor: default --- webapp/components/ContributionForm/ContributionForm.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index 1ba254aac..22b0f9ba3 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -329,6 +329,7 @@ export default { } } .checkicon { + cursor: default; top: -18px; } .checkicon_cat { From e4cbf9246bf3e6f8130bc28db108fdc26487bae2 Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 7 Nov 2019 13:00:28 +0100 Subject: [PATCH 10/93] better style and dom --- .../ContributionForm/ContributionForm.vue | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index 22b0f9ba3..f6ebf6bcc 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -24,7 +24,7 @@ {{ form.title.length }}/{{ formSchema.title.max }} - + {{ form.title.length }}/{{ formSchema.title.max }} - + @@ -48,14 +48,18 @@ @input="updateEditorContent" /> - {{ form.contentLength }} - - + size="base" + > + {{ form.contentLength }} + + + + {{ form.contentLength }} + + @@ -65,19 +69,14 @@ :existingCategoryIds="form.categoryIds" /> - - + + {{ form.categoryIds.length }} / 3 + + + + {{ form.categoryIds.length }} / 3 + + @@ -333,6 +332,6 @@ export default { top: -18px; } .checkicon_cat { - top: -38px; + top: -58px; } From 253032468f8a1913adb0896c86304e78dd1f5f2c Mon Sep 17 00:00:00 2001 From: roschaefer Date: Thu, 7 Nov 2019 14:17:22 +0100 Subject: [PATCH 11/93] Refactor: Re-use validation via error slot --- .../ContributionForm/ContributionForm.vue | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index f6ebf6bcc..4c55a89b3 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -22,22 +22,12 @@ autofocus /> - + {{ form.title.length }}/{{ formSchema.title.max }} - + {{ form.title.length }}/{{ formSchema.title.max }} - - - - {{ form.title.length }}/{{ formSchema.title.max }} - From c83a808825a7676edde2a5f34714297626035f2a Mon Sep 17 00:00:00 2001 From: roschaefer Date: Thu, 7 Nov 2019 14:22:05 +0100 Subject: [PATCH 12/93] Refactor content length validation with transform --- .../ContributionForm/ContributionForm.vue | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index 4c55a89b3..224390d7e 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -39,16 +39,15 @@ /> - {{ form.contentLength }} + {{ contentLength }} - - {{ form.contentLength }} - + + {{ contentLength }} @@ -135,7 +134,6 @@ export default { form: { title: '', content: '', - contentLength: 0, teaserImage: null, image: null, language: null, @@ -144,7 +142,13 @@ export default { }, formSchema: { title: { required: true, min: 3, max: 100 }, - content: { required: true, min: 3 }, + content: { + required: true, + min: 3, + transform: (content) => { + return this.$filters.removeHtml(content) + } + }, }, id: null, loading: false, @@ -168,11 +172,13 @@ export default { this.form.content = contribution.content this.form.image = contribution.image this.form.categoryIds = this.categoryIds(contribution.categories) - this.manageContent(this.form.content) }, }, }, computed: { + contentLength() { + return this.$filters.removeHtml(this.form.content).length + }, locale() { const locale = this.contribution && this.contribution.language @@ -230,14 +236,7 @@ export default { }) }, updateEditorContent(value) { - // TODO: Do smth????? what is happening this.$refs.contributionForm.update('content', value) - this.manageContent(value) - }, - manageContent(content) { - let str = content.replace(/<\/?[^>]+(>|$)/gm, '') - this.form.contentLength = str.length - this.validatePost() }, availableLocales() { orderBy(locales, 'name').map(locale => { @@ -259,10 +258,9 @@ export default { return categoryIds }, validatePost() { - const passesContentValidations = this.form.contentLength >= this.contentMin const passesCategoryValidations = this.form.categoryIds.length > 0 && this.form.categoryIds.length <= 3 - this.failsValidations = !(passesContentValidations && passesCategoryValidations) + this.failsValidations = !(passesCategoryValidations) }, }, apollo: { From dd03f4b7f09623fb9eb11cd7197b1192c221417b Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 7 Nov 2019 15:40:58 +0100 Subject: [PATCH 13/93] Fix Add Language check for form submit --- .../ContributionForm/ContributionForm.vue | 39 +++++++++++++++---- webapp/locales/de.json | 3 +- webapp/locales/en.json | 3 +- 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index f6ebf6bcc..236a1a722 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -24,7 +24,7 @@ {{ form.title.length }}/{{ formSchema.title.max }} - + {{ form.contentLength }} - + {{ form.contentLength }} @@ -71,7 +71,7 @@ {{ form.categoryIds.length }} / 3 - + > {{ form.categoryIds.length }} / 3 @@ -79,18 +79,28 @@ - - + + + + {{ form.language.label }} + + + + {{ $t('contribution.languageSelectLabel') }} + + +
= this.contentMin const passesCategoryValidations = this.form.categoryIds.length > 0 && this.form.categoryIds.length <= 3 - this.failsValidations = !(passesContentValidations && passesCategoryValidations) + const passedLanguageValidation = this.form.language !== null + + this.failsValidations = !( + passesContentValidations && + passesCategoryValidations && + passedLanguageValidation + ) }, }, apollo: { @@ -334,4 +356,7 @@ export default { .checkicon_cat { top: -58px; } +.colorRed { + color: red; +} diff --git a/webapp/locales/de.json b/webapp/locales/de.json index 34cd948ed..eba0c7d26 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -579,7 +579,8 @@ "filterFollow": "Beiträge filtern von Usern denen ich folge", "filterALL": "Alle Beiträge anzeigen", "success": "Gespeichert!", - "languageSelectLabel": "Sprache", + "languageSelectLabel": "Sprache deines Beitrags", + "languageSelectText": "Sprache wählen", "categories": { "infoSelectedNoOfMaxCategories": "{chosen} von {max} Kategorien ausgewählt" }, diff --git a/webapp/locales/en.json b/webapp/locales/en.json index d3b4e8edc..e51eab534 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -580,7 +580,8 @@ "filterFollow": "Filter contributions from users I follow", "filterALL": "View all contributions", "success": "Saved!", - "languageSelectLabel": "Language", + "languageSelectLabel": "Language of your contribution", + "languageSelectText": "Select Language", "categories": { "infoSelectedNoOfMaxCategories": "{chosen} of {max} categories selected" }, From 62b393b0f00e07d2a4a16cff342546c69d4cb58b Mon Sep 17 00:00:00 2001 From: roschaefer Date: Thu, 7 Nov 2019 23:23:47 +0100 Subject: [PATCH 14/93] Refactoring of Categories Select component --- .../CategoriesSelect/CategoriesSelect.vue | 37 ++++------ .../ContributionForm/ContributionForm.vue | 67 ++++++------------- 2 files changed, 33 insertions(+), 71 deletions(-) diff --git a/webapp/components/CategoriesSelect/CategoriesSelect.vue b/webapp/components/CategoriesSelect/CategoriesSelect.vue index cbe46b890..9b54b3283 100644 --- a/webapp/components/CategoriesSelect/CategoriesSelect.vue +++ b/webapp/components/CategoriesSelect/CategoriesSelect.vue @@ -28,16 +28,23 @@ From 19602d73119b785ec23af18f93e38014c7cba404 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 11 Nov 2019 22:21:59 +0100 Subject: [PATCH 18/93] language is fetched in postFragment --- webapp/graphql/Fragments.js | 1 + 1 file changed, 1 insertion(+) diff --git a/webapp/graphql/Fragments.js b/webapp/graphql/Fragments.js index 37ec15435..faff33b47 100644 --- a/webapp/graphql/Fragments.js +++ b/webapp/graphql/Fragments.js @@ -45,6 +45,7 @@ export const postFragment = lang => gql` deleted slug image + language author { ...user } From d0c0fd373a80fd601e1c48c46291802db16dfa00 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 11 Nov 2019 22:42:37 +0100 Subject: [PATCH 19/93] Language attribute added to post and postCard --- webapp/components/PostCard/PostCard.vue | 5 +++++ webapp/pages/post/_id/_slug/index.vue | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/webapp/components/PostCard/PostCard.vue b/webapp/components/PostCard/PostCard.vue index f368fadbb..2fc0b8bca 100644 --- a/webapp/components/PostCard/PostCard.vue +++ b/webapp/components/PostCard/PostCard.vue @@ -1,5 +1,6 @@