logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git

filtering_tab.js (1362B)


  1. import { filter, trim, debounce } from 'lodash'
  2. import BooleanSetting from '../helpers/boolean_setting.vue'
  3. import ChoiceSetting from '../helpers/choice_setting.vue'
  4. import IntegerSetting from '../helpers/integer_setting.vue'
  5. import SharedComputedObject from '../helpers/shared_computed_object.js'
  6. const FilteringTab = {
  7. data () {
  8. return {
  9. muteWordsStringLocal: this.$store.getters.mergedConfig.muteWords.join('\n'),
  10. replyVisibilityOptions: ['all', 'following', 'self'].map(mode => ({
  11. key: mode,
  12. value: mode,
  13. label: this.$t(`settings.reply_visibility_${mode}`)
  14. }))
  15. }
  16. },
  17. components: {
  18. BooleanSetting,
  19. ChoiceSetting,
  20. IntegerSetting
  21. },
  22. computed: {
  23. ...SharedComputedObject(),
  24. muteWordsString: {
  25. get () {
  26. return this.muteWordsStringLocal
  27. },
  28. set (value) {
  29. this.muteWordsStringLocal = value
  30. this.debouncedSetMuteWords(value)
  31. }
  32. },
  33. debouncedSetMuteWords () {
  34. return debounce((value) => {
  35. this.$store.dispatch('setOption', {
  36. name: 'muteWords',
  37. value: filter(value.split('\n'), (word) => trim(word).length > 0)
  38. })
  39. }, 1000)
  40. }
  41. },
  42. // Updating nested properties
  43. watch: {
  44. replyVisibility () {
  45. this.$store.dispatch('queueFlushAll')
  46. }
  47. }
  48. }
  49. export default FilteringTab