[MM-41998] Channel Info RHS: display number of files for a channel (#19822)

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Julien Tant
2022-03-25 13:28:14 -07:00
коммит произвёл GitHub
родитель 1c49366f00
Коммит 0babc01749
15 изменённых файлов: 181 добавлений и 0 удалений

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

@@ -2188,6 +2188,25 @@ func (s SqlChannelStore) GetMemberCountFromCache(channelId string) int64 {
return count
}
func (s SqlChannelStore) GetFileCount(channelId string) (int64, error) {
var count int64
err := s.GetReplicaX().Get(&count, `
SELECT
COUNT(*)
FROM
FileInfo
LEFT JOIN Posts as P ON FileInfo.PostId=P.Id
LEFT JOIN Channels as C on C.Id=P.ChannelId
WHERE
FileInfo.DeleteAt = 0
AND C.Id = ?`, channelId)
if err != nil {
return 0, errors.Wrapf(err, "failed to count files with channelId=%s", channelId)
}
return count, nil
}
//nolint:unparam
func (s SqlChannelStore) GetMemberCount(channelId string, allowFromCache bool) (int64, error) {
var count int64