[MM-36544][MM-37439] Don't re-follow on reply to unfollowed thread (#18020)

Summary
If a user has unfollowed a thread, another user's reply in the thread should not cause the first user to re-follow the thread. The first user will be re-followed if they are mentioned in the thread.
Simplify and make flexible the logic surrounding following and remove some duplicate code.

Ticket Link
https://mattermost.atlassian.net/browse/MM-36544
https://mattermost.atlassian.net/browse/MM-37439
Этот коммит содержится в:
Ashish Bhate
2021-07-30 18:47:41 +05:30
коммит произвёл GitHub
родитель 973e008c53
Коммит 296076bf2d
6 изменённых файлов: 62 добавлений и 8 удалений

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

@@ -212,14 +212,16 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
return
}
}
updateFollowing := *a.Config().ServiceSettings.ThreadAutoFollow
if mentionType == ThreadMention || mentionType == CommentMention {
incrementMentions = false
updateFollowing = false
}
opts := store.ThreadMembershipOpts{
Following: true,
IncrementMentions: incrementMentions,
UpdateFollowing: *a.Config().ServiceSettings.ThreadAutoFollow,
UpdateFollowing: updateFollowing,
UpdateViewedTimestamp: userID == post.UserId,
UpdateParticipants: userID == post.UserId,
}