MM-34609 Mark-as-unread on a post in a thread should cause auto-follow (#17343)

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Eli Yukelzon
2021-04-16 10:26:08 +03:00
коммит произвёл GitHub
родитель 518e0ed371
Коммит f90209c8a3
11 изменённых файлов: 78 добавлений и 35 удалений

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

@@ -2385,6 +2385,9 @@ func (a *App) MarkChannelAsUnreadFromPost(postID string, userID string) (*model.
}
threadMembership, _ := a.Srv().Store.Thread().GetMembershipForUser(user.Id, threadId)
if threadMembership == nil {
threadMembership, _ = a.Srv().Store.Thread().MaintainMembership(user.Id, threadId, true, true, true, true)
}
if threadMembership != nil && threadMembership.Following {
channel, nErr := a.Srv().Store.Channel().Get(post.ChannelId, true)
if nErr != nil {

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

@@ -185,7 +185,7 @@ func (a *App) SendNotifications(post *model.Post, team *model.Team, channel *mod
go func(userID string) {
defer close(mac)
_, incrementMentions := mentions.Mentions[userID]
err := a.Srv().Store.Thread().MaintainMembership(userID, post.RootId, true, incrementMentions, *a.Config().ServiceSettings.ThreadAutoFollow, userID == post.UserId)
_, err := a.Srv().Store.Thread().MaintainMembership(userID, post.RootId, true, incrementMentions, *a.Config().ServiceSettings.ThreadAutoFollow, userID == post.UserId)
if err != nil {
mac <- model.NewAppError("SendNotifications", "app.channel.autofollow.app_error", nil, err.Error(), http.StatusInternalServerError)
return

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

@@ -2424,7 +2424,7 @@ func (a *App) UpdateThreadsReadForUser(userID, teamID string) *model.AppError {
}
func (a *App) UpdateThreadFollowForUser(userID, teamID, threadID string, state bool) *model.AppError {
err := a.Srv().Store.Thread().MaintainMembership(userID, threadID, state, false, true, false)
_, err := a.Srv().Store.Thread().MaintainMembership(userID, threadID, state, false, true, false)
if err != nil {
return model.NewAppError("UpdateThreadFollowForUser", "app.user.update_thread_follow_for_user.app_error", nil, err.Error(), http.StatusInternalServerError)
}