From a14b74f97543e89ceca32771820942f600ad2b4d Mon Sep 17 00:00:00 2001 From: Angelina Filippova Date: Fri, 8 Nov 2019 21:26:49 +0900 Subject: [PATCH] Replace getters by computed values on activitypub, auth and captcha tabs --- src/views/settings/components/ActivityPub.vue | 15 ++++++---- .../settings/components/Authentication.vue | 29 ++++++++++++------- src/views/settings/components/Captcha.vue | 17 +++++++---- 3 files changed, 40 insertions(+), 21 deletions(-) diff --git a/src/views/settings/components/ActivityPub.vue b/src/views/settings/components/ActivityPub.vue index 46535313..24618362 100644 --- a/src/views/settings/components/ActivityPub.vue +++ b/src/views/settings/components/ActivityPub.vue @@ -23,23 +23,28 @@ export default { components: { Setting }, computed: { ...mapGetters([ - 'activitypubData', - 'userData' + 'settings' ]), activitypub() { - return this.$store.state.settings.description.find(setting => setting.key === ':activitypub') + return this.settings.description.find(setting => setting.key === ':activitypub') + }, + activitypubData() { + return this.settings.settings[':activitypub'] }, isMobile() { return this.$store.state.app.device === 'mobile' }, labelWidth() { - return this.isMobile ? '100px' : '210px' + return this.isMobile ? '100px' : '240px' }, loading() { return this.$store.state.settings.loading }, user() { - return this.$store.state.settings.description.find(setting => setting.key === ':user') + return this.settings.description.find(setting => setting.key === ':user') + }, + userData() { + return this.settings.settings[':user'] } }, methods: { diff --git a/src/views/settings/components/Authentication.vue b/src/views/settings/components/Authentication.vue index c539c46b..e0eec56d 100644 --- a/src/views/settings/components/Authentication.vue +++ b/src/views/settings/components/Authentication.vue @@ -31,31 +31,40 @@ export default { components: { Setting }, computed: { ...mapGetters([ - 'pleromaAuthenticatorData', - 'ldapData', - 'authData', - 'oauth2Data' + 'settings' ]), auth() { - return this.$store.state.settings.description.find(setting => setting.key === ':auth') + return this.settings.description.find(setting => setting.key === ':auth') + }, + authData() { + return this.settings.settings[':auth'] }, isMobile() { return this.$store.state.app.device === 'mobile' }, labelWidth() { - return this.isMobile ? '100px' : '210px' + return this.isMobile ? '100px' : '240px' }, ldap() { - return this.$store.state.settings.description.find(setting => setting.key === ':ldap') + return this.settings.description.find(setting => setting.key === ':ldap') + }, + ldapData() { + return this.settings.settings[':ldap'] }, loading() { - return this.$store.state.settings.loading + return this.settings.loading }, oauth2() { - return this.$store.state.settings.description.find(setting => setting.key === ':oauth2') + return this.settings.description.find(setting => setting.key === ':oauth2') + }, + oauth2Data() { + return this.settings.settings[':oauth2'] }, pleromaAuthenticator() { - return this.$store.state.settings.description.find(setting => setting.description === 'Authenticator') + return this.settings.description.find(setting => setting.description === 'Authenticator') + }, + pleromaAuthenticatorData() { + return this.settings.settings[''] } }, methods: { diff --git a/src/views/settings/components/Captcha.vue b/src/views/settings/components/Captcha.vue index e148f5d4..6dbc92ac 100644 --- a/src/views/settings/components/Captcha.vue +++ b/src/views/settings/components/Captcha.vue @@ -23,23 +23,28 @@ export default { components: { Setting }, computed: { ...mapGetters([ - 'captchaData', - 'kocaptchaData' + 'settings' ]), captcha() { - return this.$store.state.settings.description.find(setting => setting.key === 'Pleroma.Captcha') + return this.settings.description.find(setting => setting.key === 'Pleroma.Captcha') + }, + captchaData() { + return this.settings.settings['Pleroma.Captcha'] }, isMobile() { return this.$store.state.app.device === 'mobile' }, kocaptcha() { - return this.$store.state.settings.description.find(setting => setting.key === 'Pleroma.Captcha.Kocaptcha') + return this.settings.description.find(setting => setting.key === 'Pleroma.Captcha.Kocaptcha') + }, + kocaptchaData() { + return this.settings.settings['Pleroma.Captcha.Kocaptcha'] }, labelWidth() { - return this.isMobile ? '100px' : '210px' + return this.isMobile ? '100px' : '240px' }, loading() { - return this.$store.state.settings.loading + return this.settings.loading } }, methods: {