Audit usage of the searchPosts API (#29909)
* Audit calls to searchPosts API * Update server/public/model/post_search_results.go Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com> * Update server/public/model/post_search_results.go * Update server/public/model/post_search_results.go --------- Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com> Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
@@ -207,6 +207,21 @@ type SearchParameter struct {
|
||||
IncludeDeletedChannels *bool `json:"include_deleted_channels"`
|
||||
}
|
||||
|
||||
func (sp SearchParameter) Auditable() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"terms": sp.Terms,
|
||||
"is_or_search": sp.IsOrSearch,
|
||||
"time_zone_offset": sp.TimeZoneOffset,
|
||||
"page": sp.Page,
|
||||
"per_page": sp.PerPage,
|
||||
"include_deleted_channels": sp.IncludeDeletedChannels,
|
||||
}
|
||||
}
|
||||
|
||||
func (sp SearchParameter) LogClone() any {
|
||||
return sp.Auditable()
|
||||
}
|
||||
|
||||
type AnalyticsPostCountsOptions struct {
|
||||
TeamId string
|
||||
BotsOnly bool
|
||||
|
||||
@@ -39,3 +39,18 @@ func (o *PostSearchResults) ForPlugin() *PostSearchResults {
|
||||
plCopy.PostList = plCopy.PostList.ForPlugin()
|
||||
return &plCopy
|
||||
}
|
||||
|
||||
func (o *PostSearchResults) Auditable() map[string]interface{} {
|
||||
var numResults int
|
||||
var hasNext bool
|
||||
|
||||
if o.PostList != nil {
|
||||
numResults = len(o.PostList.Posts)
|
||||
hasNext = SafeDereference(o.PostList.HasNext)
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"num_results": numResults,
|
||||
"has_next": hasNext,
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user