diff --git a/handlers/event.go b/handlers/event.go index 7f40caa..fd1121d 100644 --- a/handlers/event.go +++ b/handlers/event.go @@ -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") diff --git a/service/slack.go b/service/slack.go index 60c6c04..98e4d58 100644 --- a/service/slack.go +++ b/service/slack.go @@ -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 diff --git a/views/view.go b/views/view.go index 2227d6b..baf5949 100644 --- a/views/view.go +++ b/views/view.go @@ -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)