MM-36429 Do not increment mention counts when marking root posts with no replies as unread (#17826)

Automatic Merge
Этот коммит содержится в:
Joram Wilander
2021-06-24 16:35:03 -04:00
коммит произвёл GitHub
родитель 33e2ae4775
Коммит e08ebf3871
5 изменённых файлов: 140 добавлений и 36 удалений

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

@@ -110,7 +110,7 @@ func (s *SqlThreadStore) get(ex gorp.SqlExecutor, id string) (*model.Thread, err
err := ex.SelectOne(&thread, query, args...)
if err != nil {
if err == sql.ErrNoRows {
return nil, store.NewErrNotFound("Thread", id)
return nil, nil
}
return nil, errors.Wrapf(err, "failed to get thread with id=%s", id)
@@ -626,7 +626,7 @@ func (s *SqlThreadStore) MaintainMembership(userId, postId string, opts store.Th
if getErr != nil {
return nil, getErr
}
if !thread.Participants.Contains(userId) {
if thread != nil && !thread.Participants.Contains(userId) {
thread.Participants = append(thread.Participants, userId)
if _, err = s.update(trx, thread); err != nil {
return nil, err