Fix notification for channels

This commit is contained in:
erroneousboat 2017-12-16 16:11:46 +01:00
parent e596093f19
commit 45b1dac1bf
3 changed files with 9 additions and 7 deletions

View File

@ -347,7 +347,7 @@ func actionChangeChannel(ctx *context.AppContext) {
}
func actionNewMessage(ctx *context.AppContext, channelID string) {
ctx.Service.MarkAsUnread(ctx.View.Channels.SelectedChannel)
ctx.Service.MarkAsUnread(channelID)
ctx.View.Channels.SetChannels(ctx.Service.ChannelsToString())
termui.Render(ctx.View.Channels)
fmt.Print("\a")

View File

@ -245,12 +245,15 @@ func (s *SlackService) MarkAsRead(channelID int) {
}
// MarkAsUnread will set the channel as unread
func (s *SlackService) MarkAsUnread(channelID int) {
channel := s.Channels[channelID]
if !channel.Notification {
channel.Notification = true
func (s *SlackService) MarkAsUnread(channelID string) {
var index int
for i, channel := range s.Channels {
if channel.ID == channelID {
index = i
break
}
}
s.Channels[index].Notification = true
}
// SendMessage will send a message to a particular channel

View File

@ -25,7 +25,6 @@ func CreateView(svc *service.SlackService) *View {
// Channels: fill the component
slackChans := svc.GetChannels()
channels.SetChannels(slackChans)
// channels.SetPresenceChannels(slackChans)
// Chat: create the component
chat := components.CreateChatComponent(input.Par.Height)