aboutsummaryrefslogtreecommitdiff
path: root/src/components/quick_view_settings/quick_view_settings.js
blob: 2798f37ac47e6d185c4e616a012d4efe469a283d (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
64
65
66
67
68
69
import Popover from '../popover/popover.vue'
import { mapGetters } from 'vuex'
import { library } from '@fortawesome/fontawesome-svg-core'
import { faList, faFolderTree, faBars, faWrench } from '@fortawesome/free-solid-svg-icons'

library.add(
  faList,
  faFolderTree,
  faBars,
  faWrench
)

const QuickViewSettings = {
  props: {
    conversation: Boolean
  },
  components: {
    Popover
  },
  methods: {
    setConversationDisplay (visibility) {
      this.$store.dispatch('setOption', { name: 'conversationDisplay', value: visibility })
    },
    openTab (tab) {
      this.$store.dispatch('openSettingsModalTab', tab)
    }
  },
  computed: {
    ...mapGetters(['mergedConfig']),
    loggedIn () {
      return !!this.$store.state.users.currentUser
    },
    conversationDisplay: {
      get () { return this.mergedConfig.conversationDisplay },
      set (newVal) { this.setConversationDisplay(newVal) }
    },
    autoUpdate: {
      get () { return this.mergedConfig.streaming },
      set () {
        const value = !this.autoUpdate
        this.$store.dispatch('setOption', { name: 'streaming', value })
      }
    },
    collapseWithSubjects: {
      get () { return this.mergedConfig.collapseMessageWithSubject },
      set () {
        const value = !this.collapseWithSubjects
        this.$store.dispatch('setOption', { name: 'collapseMessageWithSubject', value })
      }
    },
    showUserAvatars: {
      get () { return this.mergedConfig.mentionLinkShowAvatar },
      set () {
        const value = !this.showUserAvatars
        console.log(value)
        this.$store.dispatch('setOption', { name: 'mentionLinkShowAvatar', value })
      }
    },
    muteBotStatuses: {
      get () { return this.mergedConfig.muteBotStatuses },
      set () {
        const value = !this.muteBotStatuses
        this.$store.dispatch('setOption', { name: 'muteBotStatuses', value })
      }
    }
  }
}

export default QuickViewSettings