simplified code, review

This commit is contained in:
Henry Jameson 2020-12-18 01:01:58 +02:00
parent 0cf06cb9ec
commit 93af7ee36a

View file

@ -15,6 +15,7 @@ import UserReportingModal from './components/user_reporting_modal/user_reporting
import PostStatusModal from './components/post_status_modal/post_status_modal.vue' import PostStatusModal from './components/post_status_modal/post_status_modal.vue'
import GlobalNoticeList from './components/global_notice_list/global_notice_list.vue' import GlobalNoticeList from './components/global_notice_list/global_notice_list.vue'
import { windowWidth, windowHeight } from './services/window_utils/window_utils' import { windowWidth, windowHeight } from './services/window_utils/window_utils'
import { mapGetters } from 'vuex'
export default { export default {
name: 'app', name: 'app',
@ -50,17 +51,15 @@ export default {
}, },
computed: { computed: {
currentUser () { return this.$store.state.users.currentUser }, currentUser () { return this.$store.state.users.currentUser },
background () { userBackground () { return this.currentUser.background_image },
return this.currentUser.background_image || this.$store.state.instance.background instanceBackground () {
return this.mergedConfig.hideInstanceWallpaper
? null
: this.$store.state.instance.background
}, },
background () { return this.userBackground || this.instanceBackground },
bgStyle () { bgStyle () {
if ( if (this.background) {
this.currentUser.background_image ||
(
this.$store.state.instance.background &&
!this.$store.getters.mergedConfig.hideInstanceWallpaper
)
) {
return { return {
'--body-background-image': `url(${this.background})` '--body-background-image': `url(${this.background})`
} }
@ -80,7 +79,8 @@ export default {
return { return {
'order': this.$store.state.instance.sidebarRight ? 99 : 0 'order': this.$store.state.instance.sidebarRight ? 99 : 0
} }
} },
...mapGetters(['mergedConfig'])
}, },
methods: { methods: {
updateMobileState () { updateMobileState () {