[MM-49170] Implement Auditable Interface for Patch Post Struct (#21898)
* Implement Auditable Function for Patch Post Endpoint * Call auditable explicitly for patchPost patch parameter * Delete audit-config.json * Include HasReactions in Audit Log Entry for Patch
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
bef1f1cf60
Коммит
529fdd2643
@@ -802,7 +802,8 @@ func patchPost(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
auditRec := c.MakeAuditRecord("patchPost", audit.Fail)
|
||||
auditRec.AddEventParameter("patch", post)
|
||||
auditRec.AddEventParameter("id", c.Params.PostId)
|
||||
auditRec.AddEventParameter("patch", post.Auditable())
|
||||
defer c.LogAuditRecWithLevel(auditRec, app.LevelContent)
|
||||
|
||||
// Updating the file_ids of a post is not a supported operation and will be ignored
|
||||
|
||||
@@ -119,7 +119,7 @@ type Post struct {
|
||||
}
|
||||
|
||||
func (o *Post) Auditable() map[string]interface{} {
|
||||
return map[string]interface{}{ // TODO check this
|
||||
return map[string]interface{}{
|
||||
"id": o.Id,
|
||||
"create_at": o.CreateAt,
|
||||
"update_at": o.UpdateAt,
|
||||
@@ -195,6 +195,15 @@ func (o *PostPatch) WithRewrittenImageURLs(f func(string) string) *PostPatch {
|
||||
return ©
|
||||
}
|
||||
|
||||
func (o *PostPatch) Auditable() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"is_pinned": o.IsPinned,
|
||||
"props": o.Props,
|
||||
"file_ids": o.FileIds,
|
||||
"has_reactions": o.HasReactions,
|
||||
}
|
||||
}
|
||||
|
||||
type PostForExport struct {
|
||||
Post
|
||||
TeamName string
|
||||
|
||||
Ссылка в новой задаче
Block a user