From 1af5c8fd39b559a4de23dc16a06f2760102a3e24 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 22 Sep 2018 03:54:05 +0000 Subject: [PATCH] add support for disabling rich text formatting --- src/components/user_settings/user_settings.js | 4 +++- src/components/user_settings/user_settings.vue | 4 ++++ src/i18n/en.json | 1 + src/i18n/fr.json | 1 + src/services/api/api.service.js | 4 ++-- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js index 70463f2a..a6203962 100644 --- a/src/components/user_settings/user_settings.js +++ b/src/components/user_settings/user_settings.js @@ -7,6 +7,7 @@ const UserSettings = { newname: this.$store.state.users.currentUser.name, newbio: this.$store.state.users.currentUser.description, newlocked: this.$store.state.users.currentUser.locked, + newnorichtext: this.$store.state.users.currentUser.no_rich_text, newdefaultScope: this.$store.state.users.currentUser.default_scope, followList: null, followImportError: false, @@ -53,7 +54,8 @@ const UserSettings = { const locked = this.newlocked /* eslint-disable camelcase */ const default_scope = this.newdefaultScope - this.$store.state.api.backendInteractor.updateProfile({params: {name, description, locked, default_scope}}).then((user) => { + const no_rich_text = this.newnorichtext + this.$store.state.api.backendInteractor.updateProfile({params: {name, description, locked, default_scope, no_rich_text}}).then((user) => { if (!user.error) { this.$store.commit('addNewUsers', [user]) this.$store.commit('setCurrentUser', user) diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue index 9daafdce..a2a101dc 100644 --- a/src/components/user_settings/user_settings.vue +++ b/src/components/user_settings/user_settings.vue @@ -25,6 +25,10 @@ +

+ + +

diff --git a/src/i18n/en.json b/src/i18n/en.json index e18791e7..2dc6493e 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -130,6 +130,7 @@ "notification_visibility_likes": "Likes", "notification_visibility_mentions": "Mentions", "notification_visibility_repeats": "Repeats", + "no_rich_text_description": "Disable rich text support", "nsfw_clickthrough": "Enable clickthrough NSFW attachment hiding", "panelRadius": "Panels", "pause_on_unfocused": "Pause streaming when tab is not focused", diff --git a/src/i18n/fr.json b/src/i18n/fr.json index e8ddf767..022b68c1 100644 --- a/src/i18n/fr.json +++ b/src/i18n/fr.json @@ -89,6 +89,7 @@ "name": "Nom", "name_bio": "Nom & Bio", "new_password": "Nouveau mot de passe", + "no_rich_text_description": "Ne formatez pas le texte", "nsfw_clickthrough": "Masquer les images marquées comme contenu adulte ou sensible", "panelRadius": "Fenêtres", "presets": "Thèmes prédéfinis", diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 83a83e91..ab746918 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -136,8 +136,8 @@ const updateProfile = ({credentials, params}) => { const form = new FormData() each(params, (value, key) => { - /* Always include description and locked, because it might be empty or false */ - if (key === 'description' || key === 'locked' || value) { + /* Always include description, no_rich_text and locked, because it might be empty or false */ + if (key === 'description' || key === 'locked' || key === 'no_rich_text' || value) { form.append(key, value) } })