aboutsummaryrefslogtreecommitdiff
path: root/src/components/extra_notifications/extra_notifications.js
blob: 01df12a30e62b6438e021edb7dbe3118384fab30 (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
import { mapGetters } from 'vuex'

const ExtraNotifications = {
  computed: {
    shouldShowChats () {
      return this.mergedConfig.showExtraNotifications && this.mergedConfig.showChatsInExtraNotifications && this.unreadChatCount
    },
    shouldShowAnnouncements () {
      return this.mergedConfig.showExtraNotifications && this.mergedConfig.showAnnouncementsInExtraNotifications && this.unreadAnnouncementCount
    },
    shouldShowFollowRequests () {
      return this.mergedConfig.showExtraNotifications && this.mergedConfig.showFollowRequestsInExtraNotifications && this.followRequestCount
    },
    hasAnythingToShow () {
      return this.shouldShowChats || this.shouldShowAnnouncements || this.shouldShowFollowRequests
    },
    shouldShowCustomizationTip () {
      return this.mergedConfig.showExtraNotificationsTip && this.hasAnythingToShow
    },
    currentUser () {
      return this.$store.state.users.currentUser
    },
    ...mapGetters(['unreadChatCount', 'unreadAnnouncementCount', 'followRequestCount', 'mergedConfig'])
  },
  methods: {
    openNotificationSettings () {
      return this.$store.dispatch('openSettingsModalTab', 'notifications')
    },
    dismissConfigurationTip () {
      return this.$store.dispatch('setOption', { name: 'showExtraNotificationsTip', value: false })
    }
  }
}

export default ExtraNotifications