From 7a08ba43e2dc55d7c207f091700676cb886984ad Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Tue, 29 May 2018 14:19:28 +0000 Subject: [PATCH] user settings: enable locking/unlocking an account --- src/components/user_settings/user_settings.js | 4 +++- src/components/user_settings/user_settings.vue | 4 ++++ src/i18n/messages.js | 3 ++- src/services/api/api.service.js | 6 ++++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js index b6026e18..443e63dd 100644 --- a/src/components/user_settings/user_settings.js +++ b/src/components/user_settings/user_settings.js @@ -5,6 +5,7 @@ const UserSettings = { return { newname: this.$store.state.users.currentUser.name, newbio: this.$store.state.users.currentUser.description, + newlocked: this.$store.state.users.currentUser.locked, followList: null, followImportError: false, followsImported: false, @@ -34,7 +35,8 @@ const UserSettings = { updateProfile () { const name = this.newname const description = this.newbio - this.$store.state.api.backendInteractor.updateProfile({params: {name, description}}).then((user) => { + const locked = this.newlocked + this.$store.state.api.backendInteractor.updateProfile({params: {name, description, locked}}).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 fbf3f651..4abdfc8e 100644 --- a/src/components/user_settings/user_settings.vue +++ b/src/components/user_settings/user_settings.vue @@ -10,6 +10,10 @@

{{$t('settings.bio')}}

+
+ + +
diff --git a/src/i18n/messages.js b/src/i18n/messages.js index 54a99b5a..3e842af8 100644 --- a/src/i18n/messages.js +++ b/src/i18n/messages.js @@ -302,7 +302,8 @@ const en = { new_password: 'New password', confirm_new_password: 'Confirm new password', changed_password: 'Password changed successfully!', - change_password_error: 'There was an issue changing your password.' + change_password_error: 'There was an issue changing your password.', + lock_account_description: 'Restrict your account to approved followers only' }, notifications: { notifications: 'Notifications', diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 65761aee..b50038b3 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -127,11 +127,13 @@ const updateBanner = ({credentials, params}) => { const updateProfile = ({credentials, params}) => { let url = PROFILE_UPDATE_URL + console.log(params) + const form = new FormData() each(params, (value, key) => { - if (key === 'description' || /* Always include description, because it might be empty */ - value) { + /* Always include description and locked, because it might be empty or false */ + if (key === 'description' || key === 'locked' || value) { form.append(key, value) } })