Converting to structured logging the file app/notification.go (#12140)
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
4677b50811
Коммит
df85bd422f
@@ -4,7 +4,6 @@
|
|||||||
package app
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
@@ -175,14 +174,14 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
|
|||||||
// Remove the user as recipient when the user has muted the channel.
|
// Remove the user as recipient when the user has muted the channel.
|
||||||
if channelMuted, ok := channelMemberNotifyPropsMap[id][model.MARK_UNREAD_NOTIFY_PROP]; ok {
|
if channelMuted, ok := channelMemberNotifyPropsMap[id][model.MARK_UNREAD_NOTIFY_PROP]; ok {
|
||||||
if channelMuted == model.CHANNEL_MARK_UNREAD_MENTION {
|
if channelMuted == model.CHANNEL_MARK_UNREAD_MENTION {
|
||||||
mlog.Debug(fmt.Sprintf("Channel muted for user_id %v, channel_mute %v", id, channelMuted))
|
mlog.Debug("Channel muted for user", mlog.String("user_id", id), mlog.String("channel_mute", channelMuted))
|
||||||
userAllowsEmails = false
|
userAllowsEmails = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//If email verification is required and user email is not verified don't send email.
|
//If email verification is required and user email is not verified don't send email.
|
||||||
if *a.Config().EmailSettings.RequireEmailVerification && !profileMap[id].EmailVerified {
|
if *a.Config().EmailSettings.RequireEmailVerification && !profileMap[id].EmailVerified {
|
||||||
mlog.Error(fmt.Sprintf("Skipped sending notification email to %v, address not verified. [details: user_id=%v]", profileMap[id].Email, id))
|
mlog.Error("Skipped sending notification email, address not verified.", mlog.String("user_email", profileMap[id].Email), mlog.String("user_id", id))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,7 +249,12 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
|
|||||||
// MUST be completed before push notifications send
|
// MUST be completed before push notifications send
|
||||||
for _, umc := range updateMentionChans {
|
for _, umc := range updateMentionChans {
|
||||||
if err := <-umc; err != nil {
|
if err := <-umc; err != nil {
|
||||||
mlog.Warn(fmt.Sprintf("Failed to update mention count, post_id=%v channel_id=%v err=%v", post.Id, post.ChannelId, result.Err), mlog.String("post_id", post.Id))
|
mlog.Warn(
|
||||||
|
"Failed to update mention count",
|
||||||
|
mlog.String("post_id", post.Id),
|
||||||
|
mlog.String("channel_id", post.ChannelId),
|
||||||
|
mlog.Err(err),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,7 +356,7 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
|
|||||||
|
|
||||||
var infos []*model.FileInfo
|
var infos []*model.FileInfo
|
||||||
if result := <-fchan; result.Err != nil {
|
if result := <-fchan; result.Err != nil {
|
||||||
mlog.Warn(fmt.Sprint("Unable to get fileInfo for push notifications.", post.Id, result.Err), mlog.String("post_id", post.Id))
|
mlog.Warn("Unable to get fileInfo for push notifications.", mlog.String("post_id", post.Id), mlog.Err(result.Err))
|
||||||
} else {
|
} else {
|
||||||
infos = result.Data.([]*model.FileInfo)
|
infos = result.Data.([]*model.FileInfo)
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user