more refactoring

This commit is contained in:
Henry Jameson 2018-09-09 21:21:23 +03:00
parent 2db991fc7f
commit 82fa5d08c4
11 changed files with 109 additions and 76 deletions

View file

@ -3,11 +3,11 @@ const FeaturesPanel = {
chat: function () {
return this.$store.state.config.chatAvailable && (!this.$store.state.chatDisabled)
},
gopher: function () { return this.$store.state.config.gopherAvailable },
whoToFollow: function () { return this.$store.state.config.suggestionsEnabled },
mediaProxy: function () { return this.$store.state.config.mediaProxyAvailable },
scopeOptions: function () { return this.$store.state.config.scopeOptionsEnabled },
textlimit: function () { return this.$store.state.config.textlimit }
gopher: function () { return this.$store.state.instance.gopherAvailable },
whoToFollow: function () { return this.$store.state.instance.suggestionsEnabled },
mediaProxy: function () { return this.$store.state.instance.mediaProxyAvailable },
scopeOptions: function () { return this.$store.state.instance.scopeOptionsEnabled },
textlimit: function () { return this.$store.state.instance.textlimit }
}
}

View file

@ -5,7 +5,7 @@ const LoginForm = {
}),
computed: {
loggingIn () { return this.$store.state.users.loggingIn },
registrationOpen () { return this.$store.state.interface.registrationOpen }
registrationOpen () { return this.$store.state.instance.registrationOpen }
},
methods: {
submit () {

View file

@ -120,10 +120,10 @@ const PostStatusForm = {
return this.$store.state.users.users
},
emoji () {
return this.$store.state.config.emoji || []
return this.$store.state.instance.emoji || []
},
customEmoji () {
return this.$store.state.config.customEmoji || []
return this.$store.state.instance.customEmoji || []
},
statusLength () {
return this.newStatus.status.length
@ -141,10 +141,10 @@ const PostStatusForm = {
return this.hasStatusLengthLimit && (this.statusLength > this.statusLengthLimit)
},
scopeOptionsEnabled () {
return this.$store.state.config.scopeOptionsEnabled
return this.$store.state.instance.scopeOptionsEnabled
},
formattingOptionsEnabled () {
return this.$store.state.config.formattingOptionsEnabled
return this.$store.state.instance.formattingOptionsEnabled
}
},
methods: {

View file

@ -5,16 +5,16 @@ const registration = {
registering: false
}),
created () {
if ((!this.$store.state.interface.registrationOpen && !this.token) || !!this.$store.state.users.currentUser) {
if ((!this.$store.state.instance.registrationOpen && !this.token) || !!this.$store.state.users.currentUser) {
this.$router.push('/main/all')
}
// Seems like this doesn't work at first page open for some reason
if (this.$store.state.interface.registrationOpen && this.token) {
if (this.$store.state.instance.registrationOpen && this.token) {
this.$router.push('/registration')
}
},
computed: {
termsofservice () { return this.$store.state.config.tos },
termsofservice () { return this.$store.state.instance.tos },
token () { return this.$route.params.token }
},
methods: {

View file

@ -6,25 +6,26 @@ import { filter, trim } from 'lodash'
const settings = {
data () {
const config = this.$store.state.config
const user = this.$store.state.config
const instance = this.$store.state.instance
return {
hideAttachmentsLocal: config.hideAttachments,
hideAttachmentsInConvLocal: config.hideAttachmentsInConv,
hideNsfwLocal: config.hideNsfw,
notificationVisibilityLocal: config.notificationVisibility,
replyVisibilityLocal: config.replyVisibility,
loopVideoLocal: config.loopVideo,
loopVideoSilentOnlyLocal: config.loopVideoSilentOnly,
muteWordsString: config.muteWords.join('\n'),
autoLoadLocal: config.autoLoad,
streamingLocal: config.streaming,
pauseOnUnfocusedLocal: config.pauseOnUnfocused,
hoverPreviewLocal: config.hoverPreview,
collapseMessageWithSubjectLocal: typeof config.collapseMessageWithSubject === 'undefined'
? config.defaultCollapseMessageWithSubject
: config.collapseMessageWithSubject,
stopGifs: config.stopGifs,
hideAttachmentsLocal: user.hideAttachments,
hideAttachmentsInConvLocal: user.hideAttachmentsInConv,
hideNsfwLocal: user.hideNsfw,
notificationVisibilityLocal: user.notificationVisibility,
replyVisibilityLocal: user.replyVisibility,
loopVideoLocal: user.loopVideo,
loopVideoSilentOnlyLocal: user.loopVideoSilentOnly,
muteWordsString: user.muteWords.join('\n'),
autoLoadLocal: user.autoLoad,
streamingLocal: user.streaming,
pauseOnUnfocusedLocal: user.pauseOnUnfocused,
hoverPreviewLocal: user.hoverPreview,
collapseMessageWithSubjectLocal: typeof user.collapseMessageWithSubject === 'undefined'
? instance.collapseMessageWithSubject
: user.collapseMessageWithSubject,
stopGifs: user.stopGifs,
loopSilentAvailable:
// Firefox
Object.getOwnPropertyDescriptor(HTMLVideoElement.prototype, 'mozHasAudio') ||

View file

@ -7,7 +7,7 @@
<transition name="fade">
<template v-if="currentSaveStateNotice">
<div @click.prevent class="alert error" v-if="!currentSaveStateNotice.error">
<div @click.prevent class="alert error" v-if="currentSaveStateNotice.error">
Errr
</div>

View file

@ -32,10 +32,10 @@ const UserSettings = {
return this.$store.state.users.currentUser
},
pleromaBackend () {
return this.$store.state.config.pleromaBackend
return this.$store.state.instance.pleromaBackend
},
scopeOptionsEnabled () {
return this.$store.state.config.scopeOptionsEnabled
return this.$store.state.instance.scopeOptionsEnabled
},
vis () {
return {