diff --git a/model/post.go b/model/post.go index fe5df8347b..c305cd8207 100644 --- a/model/post.go +++ b/model/post.go @@ -207,6 +207,7 @@ func (o *Post) ShallowCopy(dst *Post) error { dst.Participants = o.Participants dst.LastReplyAt = o.LastReplyAt dst.Metadata = o.Metadata + dst.IsFollowing = o.IsFollowing dst.RemoteId = o.RemoteId return nil } diff --git a/store/sqlstore/post_store.go b/store/sqlstore/post_store.go index 73a2928864..9fe2b07729 100644 --- a/store/sqlstore/post_store.go +++ b/store/sqlstore/post_store.go @@ -474,7 +474,22 @@ func (s *SqlPostStore) getPostWithCollapsedThreads(id, userID string, extended b return nil, errors.Wrapf(err, "failed to get Post with id=%s", id) } - return s.prepareThreadedResponse([]*postWithExtra{&post}, extended, false) + + var posts []*model.Post + _, err = s.GetReplica().Select(&posts, "SELECT * FROM Posts WHERE Posts.RootId = :RootId AND DeleteAt = 0", map[string]interface{}{"RootId": id}) + if err != nil { + return nil, errors.Wrapf(err, "failed to find Posts for thread %s", id) + } + + list, err := s.prepareThreadedResponse([]*postWithExtra{&post}, extended, false) + if err != nil { + return nil, err + } + for _, p := range posts { + list.AddPost(p) + list.AddOrder(p.Id) + } + return list, nil } func (s *SqlPostStore) Get(ctx context.Context, id string, skipFetchThreads, collapsedThreads, collapsedThreadsExtended bool, userID string) (*model.PostList, error) {