diff --git a/store/sqlstore/post_store.go b/store/sqlstore/post_store.go index 20334d085b..cdd3145640 100644 --- a/store/sqlstore/post_store.go +++ b/store/sqlstore/post_store.go @@ -1937,7 +1937,6 @@ func (s *SqlPostStore) cleanupThreads(postId, rootId, userId string, permanent b } if thread != nil { thread.ReplyCount -= 1 - thread.Participants = thread.Participants.Remove(userId) if _, err = s.Thread().Update(thread); err != nil { return errors.Wrap(err, "failed to update thread") } diff --git a/store/storetest/thread_store.go b/store/storetest/thread_store.go index adea5c69da..38d87399b3 100644 --- a/store/storetest/thread_store.go +++ b/store/storetest/thread_store.go @@ -4,12 +4,13 @@ package storetest import ( + "testing" + "time" + "github.com/mattermost/mattermost-server/v5/model" "github.com/mattermost/mattermost-server/v5/store" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "testing" - "time" ) func TestThreadStore(t *testing.T, ss store.Store, s SqlSupplier) { @@ -120,7 +121,7 @@ func testThreadStorePopulation(t *testing.T, ss store.Store) { require.Nil(t, err, "couldn't get thread") require.NotNil(t, thread) require.Equal(t, int64(1), thread.ReplyCount) - require.ElementsMatch(t, model.StringArray{newPosts[0].UserId}, thread.Participants) + require.ElementsMatch(t, model.StringArray{newPosts[0].UserId, newPosts[1].UserId}, thread.Participants) }) t.Run("Update reply should update the UpdateAt of the thread", func(t *testing.T) { @@ -197,7 +198,7 @@ func testThreadStorePopulation(t *testing.T, ss store.Store) { thread2, err := ss.Thread().Get(rootPost.RootId) require.Nil(t, err) require.EqualValues(t, thread2.ReplyCount, 1) - require.Len(t, thread2.Participants, 1) + require.Len(t, thread2.Participants, 2) }) t.Run("Deleting root post should delete the thread", func(t *testing.T) {