diff --git a/spec/integration/store/App.spec.js b/spec/integration/store/App.spec.js index 71ea18b5..57960040 100644 --- a/spec/integration/store/App.spec.js +++ b/spec/integration/store/App.spec.js @@ -24,7 +24,8 @@ const state = () => { language: Language.en.key, defaultFonts: DefaultFonts, ignoreCW: false, - ignoreNFSW: false + ignoreNFSW: false, + hideAllAttachments: false } } diff --git a/spec/integration/store/Preferences/General.spec.js b/spec/integration/store/Preferences/General.spec.js index 9a35e2cf..fd47c82e 100644 --- a/spec/integration/store/Preferences/General.spec.js +++ b/spec/integration/store/Preferences/General.spec.js @@ -12,7 +12,8 @@ const state = () => { }, timeline: { cw: false, - nfsw: false + nfsw: false, + hideAllAttachments: false } }, loading: false @@ -88,10 +89,12 @@ describe('Preferences/General', () => { it('should be updated', async () => { await store.dispatch('Preferences/updateTimeline', { cw: true, - nfsw: true + nfsw: true, + hideAllAttachments: true }) expect(store.state.Preferences.general.timeline.cw).toEqual(true) expect(store.state.Preferences.general.timeline.nfsw).toEqual(true) + expect(store.state.Preferences.general.timeline.hideAllAttachments).toEqual(true) expect(store.state.Preferences.loading).toEqual(false) }) }) diff --git a/src/config/locales/en/translation.json b/src/config/locales/en/translation.json index c9e2590c..2e63297b 100644 --- a/src/config/locales/en/translation.json +++ b/src/config/locales/en/translation.json @@ -121,7 +121,8 @@ "title": "Timeline", "description": "Customize view in your timelines.", "cw": "Always ignore contents warnings", - "nfsw": "Always ignore NFSW of medias" + "nfsw": "Always ignore NFSW of medias", + "hideAllAttachments": "Hide all medias" } }, "appearance": { diff --git a/src/main/preferences.js b/src/main/preferences.js index 2f74ac1d..6af77a6e 100644 --- a/src/main/preferences.js +++ b/src/main/preferences.js @@ -15,7 +15,8 @@ const Base = { }, timeline: { cw: false, - nfsw: false + nfsw: false, + hideAllAttachments: false } }, state: { diff --git a/src/renderer/components/Preferences/General.vue b/src/renderer/components/Preferences/General.vue index e207bb73..5d854baa 100644 --- a/src/renderer/components/Preferences/General.vue +++ b/src/renderer/components/Preferences/General.vue @@ -36,6 +36,13 @@ active-color="#13ce66"> + + + + @@ -88,6 +95,16 @@ export default { nfsw: value }) } + }, + timeline_hide_attachments: { + get () { + return this.$store.state.Preferences.General.general.timeline.hideAllAttachments + }, + set (value) { + this.$store.dispatch('Preferences/General/updateTimeline', { + hideAllAttachments: value + }) + } } }, created () { diff --git a/src/renderer/components/molecules/Toot.vue b/src/renderer/components/molecules/Toot.vue index ba9a7906..0168c405 100644 --- a/src/renderer/components/molecules/Toot.vue +++ b/src/renderer/components/molecules/Toot.vue @@ -158,6 +158,7 @@ export default { return { showContent: this.$store.state.App.ignoreCW, showAttachments: this.$store.state.App.ignoreNFSW, + hideAllAttachments: this.$store.state.App.hideAllAttachments, now: Date.now() } }, @@ -239,7 +240,7 @@ export default { return !this.spoilered || this.showContent }, sensitive: function () { - return this.originalMessage.sensitive && this.mediaAttachments.length > 0 + return (this.hideAllAttachments || this.originalMessage.sensitive) && this.mediaAttachments.length > 0 }, isShowAttachments: function () { return !this.sensitive || this.showAttachments diff --git a/src/renderer/store/App.js b/src/renderer/store/App.js index d05b8049..98272c9c 100644 --- a/src/renderer/store/App.js +++ b/src/renderer/store/App.js @@ -23,7 +23,8 @@ const App = { language: Language.en.key, defaultFonts: DefaultFonts, ignoreCW: false, - ignoreNFSW: false + ignoreNFSW: false, + hideAllAttachments: false }, mutations: { updateTheme (state, themeColorList) { @@ -53,6 +54,9 @@ const App = { }, updateIgnoreNFSW (state, nfsw) { state.ignoreNFSW = nfsw + }, + updateHideAllAttachments (state, hideAllAttachments) { + state.hideAllAttachments = hideAllAttachments } }, actions: { @@ -82,6 +86,7 @@ const App = { commit('addFont', conf.appearance.font) commit('updateIgnoreCW', conf.general.timeline.cw) commit('updateIgnoreNFSW', conf.general.timeline.nfsw) + commit('updateHideAllAttachments', conf.general.timeline.hideAllAttachments) resolve(conf) }) }) diff --git a/src/renderer/store/Preferences/General.js b/src/renderer/store/Preferences/General.js index 3b188b6c..a7bd88da 100644 --- a/src/renderer/store/Preferences/General.js +++ b/src/renderer/store/Preferences/General.js @@ -10,7 +10,8 @@ const General = { }, timeline: { cw: false, - nfsw: false + nfsw: false, + hideAllAttachments: false } }, loading: false