diff options
author | Joram Wilander <jwawilander@gmail.com> | 2018-04-19 10:21:33 -0400 |
---|---|---|
committer | Elias Nahum <nahumhbl@gmail.com> | 2018-04-19 11:21:33 -0300 |
commit | 514033f14c16f0634ffb36584b866c153943a692 (patch) | |
tree | d71ec709e859be767c28a4a9770597a9e67f5a08 /app/notification.go | |
parent | 4921fda79ff12b5e61cf66662932ab254535e16c (diff) | |
download | chat-514033f14c16f0634ffb36584b866c153943a692.tar.gz chat-514033f14c16f0634ffb36584b866c153943a692.tar.bz2 chat-514033f14c16f0634ffb36584b866c153943a692.zip |
Fix panics caused by race in notification code (#8652)
Diffstat (limited to 'app/notification.go')
-rw-r--r-- | app/notification.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/notification.go b/app/notification.go index d69bb4e2e..d1f6225b3 100644 --- a/app/notification.go +++ b/app/notification.go @@ -179,6 +179,10 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod if a.Config().EmailSettings.SendEmailNotifications { for _, id := range mentionedUsersList { + if profileMap[id] == nil { + continue + } + userAllowsEmails := profileMap[id].NotifyProps[model.EMAIL_NOTIFY_PROP] != "false" if channelEmail, ok := channelMemberNotifyPropsMap[id][model.EMAIL_NOTIFY_PROP]; ok { if channelEmail != model.CHANNEL_NOTIFY_DEFAULT { @@ -279,6 +283,10 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod if sendPushNotifications { for _, id := range mentionedUsersList { + if profileMap[id] == nil { + continue + } + var status *model.Status var err *model.AppError if status, err = a.GetStatus(id); err != nil { @@ -291,6 +299,10 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod } for _, id := range allActivityPushUserIds { + if profileMap[id] == nil { + continue + } + if _, ok := mentionedUserIds[id]; !ok { var status *model.Status var err *model.AppError |