Revert "Optimize TotalUnreadThreads (#18788)" (#18845)

This reverts commit 971af6935c.
Этот коммит содержится в:
Agniva De Sarker
2021-10-26 14:02:03 +05:30
коммит произвёл GitHub
родитель e24f22745e
Коммит c91ab6267a

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

@@ -149,7 +149,7 @@ func (s *SqlThreadStore) GetThreadsForUser(userId, teamId string, opts model.Get
if !opts.Deleted { if !opts.Deleted {
fetchConditions = sq.And{ fetchConditions = sq.And{
fetchConditions, fetchConditions,
sq.Eq{"Posts.DeleteAt": 0}, sq.Eq{"COALESCE(Posts.DeleteAt, 0)": 0},
} }
} }
@@ -169,9 +169,9 @@ func (s *SqlThreadStore) GetThreadsForUser(userId, teamId string, opts model.Get
go func() { go func() {
repliesQuery, repliesQueryArgs, _ := s.getQueryBuilder(). repliesQuery, repliesQueryArgs, _ := s.getQueryBuilder().
Select("COUNT(DISTINCT(Posts.RootId))"). Select("COUNT(DISTINCT(Posts.RootId))").
From("Posts, ThreadMemberships, Channels"). From("Posts").
Where("Posts.RootId = ThreadMemberships.PostId"). LeftJoin("ThreadMemberships ON Posts.RootId = ThreadMemberships.PostId").
Where("Posts.ChannelId = Channels.Id"). LeftJoin("Channels ON Posts.ChannelId = Channels.Id").
Where(fetchConditions). Where(fetchConditions).
Where("Posts.CreateAt > ThreadMemberships.LastViewed").ToSql() Where("Posts.CreateAt > ThreadMemberships.LastViewed").ToSql()