Fix notification for channels
This commit is contained in:
parent
e596093f19
commit
45b1dac1bf
@ -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")
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user