From 61d40f40aee8b596f0b068091c43033ecf3aa25b Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 23 Jun 2018 07:53:15 +0000 Subject: [PATCH 1/3] allow default visibility scope to be configured --- src/App.scss | 20 +++++++++++++++++++ .../post_status_form/post_status_form.js | 2 +- .../post_status_form/post_status_form.vue | 19 ------------------ src/components/user_settings/user_settings.js | 20 +++++++++++++++++-- .../user_settings/user_settings.vue | 11 +++++++++- src/i18n/messages.js | 3 ++- 6 files changed, 51 insertions(+), 24 deletions(-) diff --git a/src/App.scss b/src/App.scss index 2426b998..43786e9d 100644 --- a/src/App.scss +++ b/src/App.scss @@ -433,3 +433,23 @@ nav { text-align: right; padding-right: 20px; } + +.visibility-tray { + font-size: 1.2em; + padding: 3px; + cursor: pointer; + + .selected { + color: $fallback--lightFg; + color: var(--lightFg, $fallback--lightFg); + } +} + +.visibility-notice { + padding: .5em; + border: 1px solid $fallback--faint; + border: 1px solid var(--faint, $fallback--faint); + border-radius: $fallback--inputRadius; + border-radius: var(--inputRadius, $fallback--inputRadius); +} + diff --git a/src/components/post_status_form/post_status_form.js b/src/components/post_status_form/post_status_form.js index 61f2ac0a..ff3bb906 100644 --- a/src/components/post_status_form/post_status_form.js +++ b/src/components/post_status_form/post_status_form.js @@ -54,7 +54,7 @@ const PostStatusForm = { newStatus: { status: statusText, files: [], - visibility: this.messageScope || 'public' + visibility: this.messageScope || this.$store.state.users.currentUser.default_scope }, caret: 0 } diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue index 7aa0e7c4..3749271d 100644 --- a/src/components/post_status_form/post_status_form.vue +++ b/src/components/post_status_form/post_status_form.vue @@ -99,25 +99,6 @@ } } -.post-status-form .visibility-tray { - font-size: 1.2em; - padding: 3px; - cursor: pointer; - - .selected { - color: $fallback--lightFg; - color: var(--lightFg, $fallback--lightFg); - } -} - -.visibility-notice { - padding: .5em; - border: 1px solid $fallback--faint; - border: 1px solid var(--faint, $fallback--faint); - border-radius: $fallback--inputRadius; - border-radius: var(--inputRadius, $fallback--inputRadius); -} - .post-status-form, .login { .form-bottom { display: flex; diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js index 443e63dd..b5b9dda6 100644 --- a/src/components/user_settings/user_settings.js +++ b/src/components/user_settings/user_settings.js @@ -6,6 +6,7 @@ const UserSettings = { newname: this.$store.state.users.currentUser.name, newbio: this.$store.state.users.currentUser.description, newlocked: this.$store.state.users.currentUser.locked, + newdefaultScope: this.$store.state.users.currentUser.default_scope, followList: null, followImportError: false, followsImported: false, @@ -29,20 +30,35 @@ const UserSettings = { }, pleromaBackend () { return this.$store.state.config.pleromaBackend - } + }, + scopeOptionsEnabled () { + return this.$store.state.config.scopeOptionsEnabled + }, + vis () { + return { + public: { selected: this.newdefaultScope === 'public' }, + unlisted: { selected: this.newdefaultScope === 'unlisted' }, + private: { selected: this.newdefaultScope === 'private' }, + direct: { selected: this.newdefaultScope === 'direct' } + } + }, }, methods: { updateProfile () { const name = this.newname const description = this.newbio const locked = this.newlocked - this.$store.state.api.backendInteractor.updateProfile({params: {name, description, locked}}).then((user) => { + const default_scope = this.newdefaultScope + this.$store.state.api.backendInteractor.updateProfile({params: {name, description, locked, default_scope}}).then((user) => { if (!user.error) { this.$store.commit('addNewUsers', [user]) this.$store.commit('setCurrentUser', user) } }) }, + changeVis (visibility) { + this.newdefaultScope = visibility + }, uploadFile (slot, e) { const file = e.target.files[0] if (!file) { return } diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue index 881b0fa1..1a52da0f 100644 --- a/src/components/user_settings/user_settings.vue +++ b/src/components/user_settings/user_settings.vue @@ -10,9 +10,18 @@

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

-
+

+

+
+ +
+ + + + +
diff --git a/src/i18n/messages.js b/src/i18n/messages.js index 003df68c..185db5d9 100644 --- a/src/i18n/messages.js +++ b/src/i18n/messages.js @@ -332,7 +332,8 @@ const en = { confirm_new_password: 'Confirm new password', changed_password: 'Password changed successfully!', change_password_error: 'There was an issue changing your password.', - lock_account_description: 'Restrict your account to approved followers only' + lock_account_description: 'Restrict your account to approved followers only', + default_vis: 'Default visibility scope' }, notifications: { notifications: 'Notifications', From fe06beae18418c015537f187af9fff5e735f0f35 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Wed, 27 Jun 2018 13:28:07 +0000 Subject: [PATCH 2/3] fix lint issues --- src/components/user_settings/user_settings.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js index b5b9dda6..2b2de913 100644 --- a/src/components/user_settings/user_settings.js +++ b/src/components/user_settings/user_settings.js @@ -41,13 +41,14 @@ const UserSettings = { private: { selected: this.newdefaultScope === 'private' }, direct: { selected: this.newdefaultScope === 'direct' } } - }, + } }, methods: { updateProfile () { const name = this.newname const description = this.newbio 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) => { if (!user.error) { @@ -55,6 +56,7 @@ const UserSettings = { this.$store.commit('setCurrentUser', user) } }) + /* eslint-enable camelcase */ }, changeVis (visibility) { this.newdefaultScope = visibility From 56ddeec8f3452a5b75af713a40d0b5e8fa75b3cd Mon Sep 17 00:00:00 2001 From: Foxhkron Date: Sun, 19 Aug 2018 01:23:03 +0200 Subject: [PATCH 3/3] Merge upstream --- src/components/user_settings/user_settings.js | 6 +++- .../user_settings/user_settings.vue | 32 +++++++++++++------ src/i18n/messages.js | 5 ++- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js index 2b2de913..f046885e 100644 --- a/src/components/user_settings/user_settings.js +++ b/src/components/user_settings/user_settings.js @@ -18,7 +18,8 @@ const UserSettings = { deleteAccountError: false, changePasswordInputs: [ '', '', '' ], changedPassword: false, - changePasswordError: false + changePasswordError: false, + activeTab: 'profile' } }, components: { @@ -235,6 +236,9 @@ const UserSettings = { this.changePasswordError = res.error } }) + }, + activateTab (tabName) { + this.activeTab = tabName } } } diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue index 1a52da0f..c3ca1dbd 100644 --- a/src/components/user_settings/user_settings.vue +++ b/src/components/user_settings/user_settings.vue @@ -4,7 +4,12 @@ {{$t('settings.user_settings')}}
-
+
+ + + +
+

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

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

@@ -25,7 +30,7 @@
-
+

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

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

@@ -38,7 +43,7 @@
-
+

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

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

@@ -51,7 +56,7 @@
-
+

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

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

@@ -62,7 +67,7 @@
-
+

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

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

@@ -81,7 +86,7 @@

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

{{changePasswordError}}

-
+

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

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

@@ -98,15 +103,15 @@

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

-
+

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

-
+

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


-
+

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

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

@@ -146,4 +151,13 @@ margin: 0.25em; } } + +.tab-switcher { + margin: 7px 7px; + display: inline-block; + + button { + height: 30px; + } +} diff --git a/src/i18n/messages.js b/src/i18n/messages.js index 185db5d9..38e58c4c 100644 --- a/src/i18n/messages.js +++ b/src/i18n/messages.js @@ -333,7 +333,10 @@ const en = { changed_password: 'Password changed successfully!', change_password_error: 'There was an issue changing your password.', lock_account_description: 'Restrict your account to approved followers only', - default_vis: 'Default visibility scope' + default_vis: 'Default visibility scope', + profile_tab: 'Profile', + security_tab: 'Security', + data_import_export_tab: 'Data Import / Export' }, notifications: { notifications: 'Notifications',