diff --git a/client/components/LinkPreview.vue b/client/components/LinkPreview.vue index 29b802f7..bd3b0acd 100644 --- a/client/components/LinkPreview.vue +++ b/client/components/LinkPreview.vue @@ -141,6 +141,10 @@ export default { this.onPreviewUpdate(); }, }, + created() { + const shouldOpenByDefault = this.link.type === "link" ? this.$root.settings.links : this.$root.settings.media; + this.link.shown = this.link.shown && shouldOpenByDefault; + }, mounted() { // Don't display previews while they are loading on the server if (this.link.type === "loading") { @@ -172,8 +176,7 @@ export default { } }, onPreviewReady() { - const options = require("../js/options"); - this.$set(this.link, "canDisplay", options.shouldOpenMessagePreview(this.link.type)); + this.$set(this.link, "canDisplay", true); this.keepScrollPosition(); diff --git a/client/components/LinkPreviewToggle.vue b/client/components/LinkPreviewToggle.vue index 7a2b0fa3..66a56b79 100644 --- a/client/components/LinkPreviewToggle.vue +++ b/client/components/LinkPreviewToggle.vue @@ -1,6 +1,5 @@ diff --git a/client/js/options.js b/client/js/options.js index 4f57a6a2..acc841ed 100644 --- a/client/js/options.js +++ b/client/js/options.js @@ -64,16 +64,11 @@ module.exports = { initialized: false, highlightsRE: null, settings, - shouldOpenMessagePreview, syncAllSettings, processSetting, initialize, }; -function shouldOpenMessagePreview(type) { - return type === "link" ? settings.links : settings.media; -} - // Updates the checkbox and warning in settings. // When notifications are not supported, this is never called (because // checkbox state can not be changed).