diff options
author | Elias Nahum <nahumhbl@gmail.com> | 2018-04-12 10:12:59 -0300 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2018-04-12 09:12:59 -0400 |
commit | 1ebf19825bc735424f7278a3c749f83d24ab80f1 (patch) | |
tree | b94801594bd06588e997e2138586be81d5190d83 /app/channel.go | |
parent | 2d0fef4d943198014913069d2b79a73f2e3a7d9a (diff) | |
download | chat-1ebf19825bc735424f7278a3c749f83d24ab80f1.tar.gz chat-1ebf19825bc735424f7278a3c749f83d24ab80f1.tar.bz2 chat-1ebf19825bc735424f7278a3c749f83d24ab80f1.zip |
Fix mute channel when not a member and adding unit tests (#8609)
Diffstat (limited to 'app/channel.go')
-rw-r--r-- | app/channel.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/channel.go b/app/channel.go index 40f21c3a9..7c14538f4 100644 --- a/app/channel.go +++ b/app/channel.go @@ -1491,7 +1491,13 @@ func (a *App) GetDirectChannel(userId1, userId2 string) (*model.Channel, *model. } func (a *App) ToggleMuteChannel(channelId string, userId string) *model.ChannelMember { - member := (<-a.Srv.Store.Channel().GetMember(channelId, userId)).Data.(*model.ChannelMember) + result := <-a.Srv.Store.Channel().GetMember(channelId, userId) + + if result.Err != nil { + return nil + } + + member := result.Data.(*model.ChannelMember) if member.NotifyProps[model.MARK_UNREAD_NOTIFY_PROP] == model.CHANNEL_NOTIFY_MENTION { member.NotifyProps[model.MARK_UNREAD_NOTIFY_PROP] = model.CHANNEL_MARK_UNREAD_ALL |