MM-37372 Do not autofollow threads started by webhooks/bots for user who created them (#18276)

* Do not autofollow threads started by webhooks/bots for user who created them

* Add test
Этот коммит содержится в:
Joram Wilander
2021-08-26 15:24:12 -04:00
коммит произвёл GitHub
родитель 60074de844
Коммит b6ae217883
2 изменённых файлов: 47 добавлений и 2 удалений

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

@@ -201,9 +201,11 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
if *a.Config().ServiceSettings.ThreadAutoFollow && post.RootId != "" {
var rootMentions *ExplicitMentions
if parentPostList != nil {
threadParticipants[parentPostList.Posts[parentPostList.Order[0]].UserId] = true
rootPost := parentPostList.Posts[parentPostList.Order[0]]
if rootPost.GetProp("from_webhook") != "true" {
threadParticipants[rootPost.UserId] = true
}
if channel.Type != model.ChannelTypeDirect {
rootPost := parentPostList.Posts[parentPostList.Order[0]]
rootMentions = getExplicitMentions(rootPost, keywords, groups)
for id := range rootMentions.Mentions {
threadParticipants[id] = true