aboutsummaryrefslogtreecommitdiff
path: root/src/components/timeline/timeline_quick_settings.js
blob: ecac06e9582071f99ddd1ffa22c87d43f30e2312 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import Popover from '../popover/popover.vue'
import BooleanSetting from '../settings_modal/helpers/boolean_setting.vue'
import { mapGetters } from 'vuex'
import { library } from '@fortawesome/fontawesome-svg-core'
import { faFilter, faWrench } from '@fortawesome/free-solid-svg-icons'

library.add(
  faFilter,
  faWrench
)

const TimelineQuickSettings = {
  components: {
    Popover,
    BooleanSetting
  },
  methods: {
    setReplyVisibility (visibility) {
      console.log('set reply visibility', visibility)
      this.$store.dispatch('setOption', { name: 'replyVisibility', value: visibility })
      this.$store.dispatch('queueFlushAll')
    },
    openTab (tab) {
      this.$store.dispatch('openSettingsModalTab', tab)
    }
  },
  computed: {
    ...mapGetters(['mergedConfig']),
    loggedIn () {
      return !!this.$store.state.users.currentUser
    },
    replyVisibilitySelf: {
      get () { return this.mergedConfig.replyVisibility === 'self' },
      set () { this.setReplyVisibility('self') }
    },
    replyVisibilityFollowing: {
      get () { return this.mergedConfig.replyVisibility === 'following' },
      set () { this.setReplyVisibility('following') }
    },
    replyVisibilityAll: {
      get () { return this.mergedConfig.replyVisibility === 'all' },
      set () { this.setReplyVisibility('all') }
    },
    hideMedia: {
      get () { return this.mergedConfig.hideAttachments || this.mergedConfig.hideAttachmentsInConv },
      set () {
        const value = !this.hideMedia
        this.$store.dispatch('setOption', { name: 'hideAttachments', value })
        this.$store.dispatch('setOption', { name: 'hideAttachmentsInConv', value })
      }
    },
    hideMutedPosts: {
      get () { return this.mergedConfig.hideMutedPosts || this.mergedConfig.hideFilteredStatuses },
      set () {
        const value = !this.hideMutedPosts
        this.$store.dispatch('setOption', { name: 'hideMutedPosts', value })
        this.$store.dispatch('setOption', { name: 'hideFilteredStatuses', value })
      }
    }
  }
}

export default TimelineQuickSettings