From c6d05258843c77490337f004e85e40c6af3e1ea2 Mon Sep 17 00:00:00 2001 From: ayntgl <90600421+ayntgl@users.noreply.github.com> Date: Sat, 3 Dec 2022 13:12:17 +0530 Subject: [PATCH] fix(ui): draw only selected channel's messages if notifications are disabled (#258) Co-authored-by: ayn2op --- ui/application.go | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/ui/application.go b/ui/application.go index 00d3135..577a4a7 100644 --- a/ui/application.go +++ b/ui/application.go @@ -191,20 +191,22 @@ func (c *Application) onGuildDelete(g *gateway.GuildDeleteEvent) { } func (c *Application) onMessageCreate(m *gateway.MessageCreateEvent) { - if (c.view.ChannelsView.selected == nil || c.view.ChannelsView.selected.ID != m.ChannelID) && c.config.Notifications { - g, err := c.state.Cabinet.Guild(m.GuildID) - if err != nil { - log.Println(err) - return - } + if c.view.ChannelsView.selected == nil { + if c.config.Notifications { + g, err := c.state.Cabinet.Guild(m.GuildID) + if err != nil { + log.Println(err) + return + } - c, err := c.state.Cabinet.Channel(m.ChannelID) - if err != nil { - log.Println(err) - return - } + c, err := c.state.Cabinet.Channel(m.ChannelID) + if err != nil { + log.Println(err) + return + } - go beeep.Notify(fmt.Sprintf("%s %s", g.Name, c.Name), m.Content, "") + go beeep.Notify(fmt.Sprintf("%s %s", g.Name, c.Name), m.Content, "") + } } else { _, err := c.view.MessagesView.Write(buildMessage(c, m.Message)) if err != nil {