[MM-14846] Update EditAt for FileIds and Attachment in Post + Ignore FileIds Updates (#10540)

* Set EditAt for FileIds and Attachments; Disallow update/patch of FileIds in API Handler

* Add custom comparison methods for StringArray and Post Attachments

* gofmt

* Split up comparison function to child structs

* Naming consistency

* gofmt
This commit is contained in:
Daniel Schalla
2019-04-04 20:01:21 +02:00
committed by GitHub
parent 41fe33bbb1
commit 7c9837d9b1
9 changed files with 519 additions and 4 deletions

View File

@@ -437,6 +437,9 @@ func updatePost(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
// Updating the file_ids of a post is not a supported operation and will be ignored
post.FileIds = nil
if !c.App.SessionHasPermissionToChannelByPost(c.App.Session, c.Params.PostId, model.PERMISSION_EDIT_POST) {
c.SetPermissionError(model.PERMISSION_EDIT_POST)
return
@@ -479,6 +482,9 @@ func patchPost(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
// Updating the file_ids of a post is not a supported operation and will be ignored
post.FileIds = nil
if !c.App.SessionHasPermissionToChannelByPost(c.App.Session, c.Params.PostId, model.PERMISSION_EDIT_POST) {
c.SetPermissionError(model.PERMISSION_EDIT_POST)
return