diff --git a/src/boot/after_store.js b/src/boot/after_store.js index 914f63bca..8233e71cd 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -24,10 +24,6 @@ const afterStoreSetup = ({ store, i18n }) => { store.dispatch('setInstanceOption', { name: 'bannerlimit', value: parseInt(uploadlimit.bannerlimit) }) } - if (data.nsfwCensorImage) { - store.dispatch('setInstanceOption', { name: 'nsfwCensorImage', value: data.nsfwCensorImage }) - } - if (vapidPublicKey) { store.dispatch('setInstanceOption', { name: 'vapidPublicKey', value: vapidPublicKey }) } @@ -54,46 +50,44 @@ const afterStoreSetup = ({ store, i18n }) => { config = Object.assign({}, staticConfig, apiConfig) } - var theme = (config.theme) - var background = (config.background) - var hidePostStats = (config.hidePostStats) - var hideUserStats = (config.hideUserStats) - var logo = (config.logo) - var logoMask = (typeof config.logoMask === 'undefined' ? true : config.logoMask) - var logoMargin = (typeof config.logoMargin === 'undefined' ? 0 : config.logoMargin) - var redirectRootNoLogin = (config.redirectRootNoLogin) - var redirectRootLogin = (config.redirectRootLogin) - var chatDisabled = (config.chatDisabled) - var showInstanceSpecificPanel = (config.showInstanceSpecificPanel) - var scopeOptionsEnabled = (config.scopeOptionsEnabled) - var formattingOptionsEnabled = (config.formattingOptionsEnabled) - var collapseMessageWithSubject = (config.collapseMessageWithSubject) - var loginMethod = (config.loginMethod) - var scopeCopy = (config.scopeCopy) - var subjectLineBehavior = (config.subjectLineBehavior) - var alwaysShowSubjectInput = (config.alwaysShowSubjectInput) - var noAttachmentLinks = (config.noAttachmentLinks) + const copyInstanceOption = (name) => { + store.dispatch('setInstanceOption', {name, value: config[name]}) + } - store.dispatch('setInstanceOption', { name: 'theme', value: theme }) - store.dispatch('setInstanceOption', { name: 'background', value: background }) - store.dispatch('setInstanceOption', { name: 'hidePostStats', value: hidePostStats }) - store.dispatch('setInstanceOption', { name: 'hideUserStats', value: hideUserStats }) - store.dispatch('setInstanceOption', { name: 'logo', value: logo }) - store.dispatch('setInstanceOption', { name: 'logoMask', value: logoMask }) - store.dispatch('setInstanceOption', { name: 'logoMargin', value: logoMargin }) - store.dispatch('setInstanceOption', { name: 'redirectRootNoLogin', value: redirectRootNoLogin }) - store.dispatch('setInstanceOption', { name: 'redirectRootLogin', value: redirectRootLogin }) - store.dispatch('setInstanceOption', { name: 'showInstanceSpecificPanel', value: showInstanceSpecificPanel }) - store.dispatch('setInstanceOption', { name: 'scopeOptionsEnabled', value: scopeOptionsEnabled }) - store.dispatch('setInstanceOption', { name: 'formattingOptionsEnabled', value: formattingOptionsEnabled }) - store.dispatch('setInstanceOption', { name: 'collapseMessageWithSubject', value: collapseMessageWithSubject }) - store.dispatch('setInstanceOption', { name: 'loginMethod', value: loginMethod }) - store.dispatch('setInstanceOption', { name: 'scopeCopy', value: scopeCopy }) - store.dispatch('setInstanceOption', { name: 'subjectLineBehavior', value: subjectLineBehavior }) - store.dispatch('setInstanceOption', { name: 'alwaysShowSubjectInput', value: alwaysShowSubjectInput }) - store.dispatch('setInstanceOption', { name: 'noAttachmentLinks', value: noAttachmentLinks }) + copyInstanceOption('nsfwCensorImage') + copyInstanceOption('theme') + copyInstanceOption('background') + copyInstanceOption('hidePostStats') + copyInstanceOption('hideUserStats') + copyInstanceOption('logo') - if (chatDisabled) { + store.dispatch('setInstanceOption', { + name: 'logoMask', + value: typeof config.logoMask === 'undefined' + ? true + : config.logoMask + }) + + store.dispatch('setInstanceOption', { + name: 'logoMargin', + value: typeof config.logoMargin === 'undefined' + ? 0 + : config.logoMargin + }) + + copyInstanceOption('redirectRootNoLogin') + copyInstanceOption('redirectRootLogin') + copyInstanceOption('showInstanceSpecificPanel') + copyInstanceOption('scopeOptionsEnabled') + copyInstanceOption('formattingOptionsEnabled') + copyInstanceOption('collapseMessageWithSubject') + copyInstanceOption('loginMethod') + copyInstanceOption('scopeCopy') + copyInstanceOption('subjectLineBehavior') + copyInstanceOption('alwaysShowSubjectInput') + copyInstanceOption('noAttachmentLinks') + + if ((config.chatDisabled)) { store.dispatch('disableChat') } diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js index 18a037707..9212b74b5 100644 --- a/src/components/attachment/attachment.js +++ b/src/components/attachment/attachment.js @@ -11,7 +11,7 @@ const Attachment = { ], data () { return { - nsfwImage: this.$store.state.config.nsfwCensorImage || nsfwImage, + nsfwImage: this.$store.state.instance.nsfwCensorImage || nsfwImage, hideNsfwLocal: this.$store.state.config.hideNsfw, preloadImage: this.$store.state.config.preloadImage, loopVideo: this.$store.state.config.loopVideo, diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue index b80300b45..d7f25953e 100644 --- a/src/components/attachment/attachment.vue +++ b/src/components/attachment/attachment.vue @@ -10,7 +10,7 @@ Hide - + diff --git a/src/components/status/status.js b/src/components/status/status.js index 105a736b4..b14a74ec4 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -73,6 +73,14 @@ const Status = { return (this.$store.state.config.hideAttachments && !this.inConversation) || (this.$store.state.config.hideAttachmentsInConv && this.inConversation) }, + userProfileLink () { + return this.generateUserProfileLink(this.status.user.id, this.status.user.screen_name) + }, + replyProfileLink () { + if (this.isReply) { + return this.generateUserProfileLink(this.status.in_reply_to_status_id, this.replyToName) + } + }, retweet () { return !!this.statusoid.retweeted_status }, retweeter () { return this.statusoid.user.name }, retweeterHtml () { return this.statusoid.user.name_html }, @@ -119,6 +127,14 @@ const Status = { isReply () { return !!this.status.in_reply_to_status_id }, + replyToName () { + const user = this.$store.state.users.usersObject[this.status.in_reply_to_user_id] + if (user) { + return user.screen_name + } else { + return this.status.in_reply_to_screen_name + } + }, hideReply () { if (this.$store.state.config.replyVisibility === 'all') { return false @@ -277,7 +293,7 @@ const Status = { replyLeave () { this.showPreview = false }, - userProfileLink (id, name) { + generateUserProfileLink (id, name) { return generateProfileLink(id, name, this.$store.state.instance.restrictedNicknames) } }, diff --git a/src/components/status/status.vue b/src/components/status/status.vue index 4a1aef8fc..5c956467e 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -3,7 +3,7 @@