Skip to content

Commit

Permalink
Add initial check of unread messages for channels
Browse files Browse the repository at this point in the history
Fixes #174
  • Loading branch information
jpbruinsslot committed Mar 2, 2019
1 parent ca9ebaa commit 68d91ba
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions service/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ func (s *SlackService) GetChannels() ([]components.ChannelItem, error) {

chanItem.Type = components.ChannelTypeChannel

if chn.UnreadCount > 0 {
chanItem.Notification = true
}

buckets[0][chn.ID] = &tempChan{
channelItem: chanItem,
slackChannel: chn,
Expand All @@ -159,6 +163,10 @@ func (s *SlackService) GetChannels() ([]components.ChannelItem, error) {

chanItem.Type = components.ChannelTypeMpIM

if chn.UnreadCount > 0 {
chanItem.Notification = true
}

buckets[2][chn.ID] = &tempChan{
channelItem: chanItem,
slackChannel: chn,
Expand All @@ -167,6 +175,10 @@ func (s *SlackService) GetChannels() ([]components.ChannelItem, error) {

chanItem.Type = components.ChannelTypeGroup

if chn.UnreadCount > 0 {
chanItem.Notification = true
}

buckets[1][chn.ID] = &tempChan{
channelItem: chanItem,
slackChannel: chn,
Expand All @@ -185,6 +197,10 @@ func (s *SlackService) GetChannels() ([]components.ChannelItem, error) {
chanItem.Name = name
chanItem.Type = components.ChannelTypeIM

if chn.UnreadCount > 0 {
chanItem.Notification = true
}

buckets[3][chn.User] = &tempChan{
channelItem: chanItem,
slackChannel: chn,
Expand Down

0 comments on commit 68d91ba

Please # to comment.