[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 удалений

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

@@ -362,7 +362,8 @@ func (a *App) CreatePost(c *request.Context, post *model.Post, channel *model.Ch
// Make sure poster is following the thread
if *a.Config().ServiceSettings.ThreadAutoFollow && rpost.RootId != "" {
_, err := a.Srv().Store.Thread().MaintainMembership(user.Id, rpost.RootId, store.ThreadMembershipOpts{
Following: true,
Following: true,
UpdateFollowing: true,
})
if err != nil {
mlog.Warn("Failed to update thread membership", mlog.Err(err))