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 {
fetchConditions = sq.And{
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() {
repliesQuery, repliesQueryArgs, _ := s.getQueryBuilder().
Select("COUNT(DISTINCT(Posts.RootId))").
From("Posts, ThreadMemberships, Channels").
Where("Posts.RootId = ThreadMemberships.PostId").
Where("Posts.ChannelId = Channels.Id").
From("Posts").
LeftJoin("ThreadMemberships ON Posts.RootId = ThreadMemberships.PostId").
LeftJoin("Channels ON Posts.ChannelId = Channels.Id").
Where(fetchConditions).
Where("Posts.CreateAt > ThreadMemberships.LastViewed").ToSql()