[MM-44263] Only include user posts in post count (#20250)

* Fetch users only posts

* Explicitly validate posts count before testing usage
Этот коммит содержится в:
Vishal
2022-05-31 14:18:41 +05:30
коммит произвёл GitHub
родитель 70610a9c96
Коммит 57e9aa767c
5 изменённых файлов: 30 добавлений и 5 удалений

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

@@ -47,7 +47,7 @@ func (ch *Channels) getIntegrationsUsage() (*model.IntegrationsUsage, *model.App
// GetPostsUsage returns "rounded off" total posts count like returns 900 instead of 987
func (a *App) GetPostsUsage() (int64, *model.AppError) {
count, err := a.Srv().Store.Post().AnalyticsPostCount(&model.PostCountOptions{ExcludeDeleted: true})
count, err := a.Srv().Store.Post().AnalyticsPostCount(&model.PostCountOptions{ExcludeDeleted: true, UsersPostsOnly: true})
if err != nil {
return 0, model.NewAppError("GetPostsUsage", "app.post.analytics_posts_count.app_error", nil, err.Error(), http.StatusInternalServerError)
}