parent
609c37cdfe
commit
8475d8d63d
@ -270,7 +270,7 @@ func actionSend(ctx *context.AppContext) {
|
||||
// Clear notification icon if there is any
|
||||
channelItem := ctx.View.Channels.ChannelItems[ctx.View.Channels.SelectedChannel]
|
||||
if channelItem.Notification {
|
||||
ctx.Service.MarkAsRead(channelItem.ID)
|
||||
ctx.Service.MarkAsRead(channelItem)
|
||||
ctx.View.Channels.MarkAsRead(ctx.View.Channels.SelectedChannel)
|
||||
}
|
||||
termui.Render(ctx.View.Channels)
|
||||
@ -425,7 +425,7 @@ func actionChangeChannel(ctx *context.AppContext) {
|
||||
// Clear notification icon if there is any
|
||||
channelItem := ctx.View.Channels.ChannelItems[ctx.View.Channels.SelectedChannel]
|
||||
if channelItem.Notification {
|
||||
ctx.Service.MarkAsRead(channelItem.ID)
|
||||
ctx.Service.MarkAsRead(channelItem)
|
||||
ctx.View.Channels.MarkAsRead(ctx.View.Channels.SelectedChannel)
|
||||
}
|
||||
|
||||
|
@ -275,11 +275,29 @@ func (s *SlackService) SetUserAsActive() {
|
||||
}
|
||||
|
||||
// MarkAsRead will set the channel as read
|
||||
func (s *SlackService) MarkAsRead(channelID string) {
|
||||
s.Client.SetChannelReadMark(
|
||||
channelID, fmt.Sprintf("%f",
|
||||
float64(time.Now().Unix())),
|
||||
)
|
||||
func (s *SlackService) MarkAsRead(channelItem components.ChannelItem) {
|
||||
switch channelItem.Type {
|
||||
case components.ChannelTypeChannel:
|
||||
s.Client.SetChannelReadMark(
|
||||
channelItem.ID, fmt.Sprintf("%f",
|
||||
float64(time.Now().Unix())),
|
||||
)
|
||||
case components.ChannelTypeGroup:
|
||||
s.Client.SetGroupReadMark(
|
||||
channelItem.ID, fmt.Sprintf("%f",
|
||||
float64(time.Now().Unix())),
|
||||
)
|
||||
case components.ChannelTypeMpIM:
|
||||
s.Client.MarkIMChannel(
|
||||
channelItem.ID, fmt.Sprintf("%f",
|
||||
float64(time.Now().Unix())),
|
||||
)
|
||||
case components.ChannelTypeIM:
|
||||
s.Client.MarkIMChannel(
|
||||
channelItem.ID, fmt.Sprintf("%f",
|
||||
float64(time.Now().Unix())),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// SendMessage will send a message to a particular channel
|
||||
|
Loading…
Reference in New Issue
Block a user