[MM15037] Stop sending notifications to user whose Oauth bot posted (#15953)

Co-authored-by: Cam Graff <cameron@woodridgesoftware.com>
Этот коммит содержится в:
camgraff
2021-01-26 09:33:44 -06:00
коммит произвёл GitHub
родитель 4b4fc58e7f
Коммит 02523cb186
3 изменённых файлов: 60 добавлений и 1 удалений

Просмотреть файл

@@ -126,7 +126,14 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
if post.RootId != "" && parentPostList != nil {
for _, threadPost := range parentPostList.Posts {
profile := profileMap[threadPost.UserId]
if profile != nil && (profile.NotifyProps[model.COMMENTS_NOTIFY_PROP] == model.COMMENTS_NOTIFY_ANY || (profile.NotifyProps[model.COMMENTS_NOTIFY_PROP] == model.COMMENTS_NOTIFY_ROOT && threadPost.Id == parentPostList.Order[0])) {
if profile == nil {
continue
}
// If this is the root post and it was posted by an OAuth bot, don't notify the user
if threadPost.Id == parentPostList.Order[0] && threadPost.IsFromOAuthBot() {
continue
}
if profile.NotifyProps[model.COMMENTS_NOTIFY_PROP] == model.COMMENTS_NOTIFY_ANY || (profile.NotifyProps[model.COMMENTS_NOTIFY_PROP] == model.COMMENTS_NOTIFY_ROOT && threadPost.Id == parentPostList.Order[0]) {
mentionType := ThreadMention
if threadPost.Id == parentPostList.Order[0] {
mentionType = CommentMention