[MM-60603] Don't follow threads when marking them as read on focus (#28263)

* [MM-60603] Don't follow threads when marking them as read on focus

* Fix tests

* Fix lint

* Fix the original bug in the API call
Этот коммит содержится в:
Devin Binnie
2024-09-26 09:02:11 -04:00
коммит произвёл GitHub
родитель 3428cd15b6
Коммит d58b048965
5 изменённых файлов: 44 добавлений и 71 удалений

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

@@ -2831,13 +2831,10 @@ func (a *App) UpdateThreadReadForUser(c request.CTX, currentSessionId, userID, t
return nil, err
}
opts := store.ThreadMembershipOpts{
Following: true,
UpdateFollowing: true,
}
membership, storeErr := a.Srv().Store().Thread().MaintainMembership(userID, threadID, opts)
if storeErr != nil {
return nil, model.NewAppError("UpdateThreadReadForUser", "app.user.update_thread_read_for_user.app_error", nil, "", http.StatusInternalServerError).Wrap(storeErr)
// If the thread doesn't have a membership, we shouldn't try to mark it as unread
membership, err := a.GetThreadMembershipForUser(userID, threadID)
if err != nil {
return nil, err
}
previousUnreadMentions := membership.UnreadMentions