From a53555254a711654399836e0f5f052d629bf4380 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Sun, 9 Apr 2017 15:53:23 +0200 Subject: Add word-based muting to settings / statuses. --- src/components/settings/settings.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/components/settings/settings.js') diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js index 3d373283..7aa4bbc4 100644 --- a/src/components/settings/settings.js +++ b/src/components/settings/settings.js @@ -5,7 +5,8 @@ const settings = { return { hideAttachmentsLocal: this.$store.state.config.hideAttachments, hideAttachmentsInConvLocal: this.$store.state.config.hideAttachmentsInConv, - hideNsfwLocal: this.$store.state.config.hideNsfw + hideNsfwLocal: this.$store.state.config.hideNsfw, + muteWordsString: this.$store.state.config.muteWords.join('\n') } }, components: { @@ -20,6 +21,9 @@ const settings = { }, hideNsfwLocal (value) { this.$store.dispatch('setOption', { name: 'hideNsfw', value }) + }, + muteWordsString (value) { + this.$store.dispatch('setOption', { name: 'muteWords', value: value.split('\n') }) } } } -- cgit v1.2.3-70-g09d2 From cd959d9df8c5cec8361892d92daf524ecfa4c76f Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Sun, 9 Apr 2017 22:15:49 +0200 Subject: Remove completely empty words. --- src/components/settings/settings.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/components/settings/settings.js') diff --git a/src/components/settings/settings.js b/src/components/settings/settings.js index 7aa4bbc4..4d0528b6 100644 --- a/src/components/settings/settings.js +++ b/src/components/settings/settings.js @@ -1,4 +1,5 @@ import StyleSwitcher from '../style_switcher/style_switcher.vue' +import { filter, trim } from 'lodash' const settings = { data () { @@ -23,7 +24,8 @@ const settings = { this.$store.dispatch('setOption', { name: 'hideNsfw', value }) }, muteWordsString (value) { - this.$store.dispatch('setOption', { name: 'muteWords', value: value.split('\n') }) + value = filter(value.split('\n'), (word) => trim(word).length > 0) + this.$store.dispatch('setOption', { name: 'muteWords', value }) } } } -- cgit v1.2.3-70-g09d2