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) {
|
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())
|
ctx.View.Channels.SetChannels(ctx.Service.ChannelsToString())
|
||||||
termui.Render(ctx.View.Channels)
|
termui.Render(ctx.View.Channels)
|
||||||
fmt.Print("\a")
|
fmt.Print("\a")
|
||||||
|
@ -245,12 +245,15 @@ func (s *SlackService) MarkAsRead(channelID int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MarkAsUnread will set the channel as unread
|
// MarkAsUnread will set the channel as unread
|
||||||
func (s *SlackService) MarkAsUnread(channelID int) {
|
func (s *SlackService) MarkAsUnread(channelID string) {
|
||||||
channel := s.Channels[channelID]
|
var index int
|
||||||
|
for i, channel := range s.Channels {
|
||||||
if !channel.Notification {
|
if channel.ID == channelID {
|
||||||
channel.Notification = true
|
index = i
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
s.Channels[index].Notification = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendMessage will send a message to a particular channel
|
// SendMessage will send a message to a particular channel
|
||||||
|
@ -25,7 +25,6 @@ func CreateView(svc *service.SlackService) *View {
|
|||||||
// Channels: fill the component
|
// Channels: fill the component
|
||||||
slackChans := svc.GetChannels()
|
slackChans := svc.GetChannels()
|
||||||
channels.SetChannels(slackChans)
|
channels.SetChannels(slackChans)
|
||||||
// channels.SetPresenceChannels(slackChans)
|
|
||||||
|
|
||||||
// Chat: create the component
|
// Chat: create the component
|
||||||
chat := components.CreateChatComponent(input.Par.Height)
|
chat := components.CreateChatComponent(input.Par.Height)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user