Fix hide mpim

Fixes #122
This commit is contained in:
erroneousboat 2018-10-13 15:32:21 +02:00
parent 562c3f6761
commit faa1cf2148
3 changed files with 23 additions and 15 deletions

View File

@ -14,7 +14,7 @@ const (
IconChannel = "#"
IconGroup = "☰"
IconIM = "●"
IconMpIM = "●" // TODO
IconMpIM = "☰"
IconNotification = "*"
PresenceAway = "away"
@ -145,6 +145,7 @@ func (c *Channels) Buffer() termui.Buffer {
item.ToString(), c.List.ItemFgColor, c.List.ItemBgColor)
}
// Append ellipsis when overflows
cells = termui.DTrimTxCls(cells, c.List.InnerWidth())
x := 0

View File

@ -139,9 +139,10 @@ func messageHandler(ctx *context.AppContext) {
// I'm currently in a channel but not in the terminal
// window (tmux). But only create a notification when
// it comes from someone else but the current user.
if ev.User != ctx.Service.CurrentUserID {
actionNewMessage(ctx, ev)
}
// if ev.User != ctx.Service.CurrentUserID {
// actionNewMessage(ctx, ev)
// }
actionNewMessage(ctx, ev)
case *slack.PresenceChangeEvent:
actionSetPresence(ctx, ev.User, ev.Presence)
case *slack.RTMError:

View File

@ -151,20 +151,26 @@ func (s *SlackService) GetChannels() []components.ChannelItem {
continue
}
chanItem.Type = components.ChannelTypeGroup
// This is done because MpIM channels are also considered groups
if chn.IsMpIM {
if !chn.IsOpen {
continue
}
buckets[1][chn.ID] = &tempChan{
channelItem: chanItem,
slackChannel: chn,
}
}
chanItem.Type = components.ChannelTypeMpIM
if chn.IsMpIM {
chanItem.Type = components.ChannelTypeMpIM
buckets[2][chn.ID] = &tempChan{
channelItem: chanItem,
slackChannel: chn,
}
} else {
buckets[2][chn.ID] = &tempChan{
channelItem: chanItem,
slackChannel: chn,
chanItem.Type = components.ChannelTypeGroup
buckets[1][chn.ID] = &tempChan{
channelItem: chanItem,
slackChannel: chn,
}
}
}