[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
Этот коммит содержится в:
Daniel Schalla
2019-04-04 20:01:21 +02:00
коммит произвёл GitHub
родитель 41fe33bbb1
Коммит 7c9837d9b1
9 изменённых файлов: 519 добавлений и 4 удалений

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

@@ -506,6 +506,11 @@ func (a *App) UpdatePost(post *model.Post, safeUpdate bool) (*model.Post, *model
newPost.Props = post.Props
}
// Avoid deep-equal checks if EditAt was already modified through message change
if newPost.EditAt == oldPost.EditAt && (!oldPost.FileIds.Equals(newPost.FileIds) || !oldPost.AttachmentsEqual(newPost)) {
newPost.EditAt = model.GetMillis()
}
if err := a.FillInPostProps(post, nil); err != nil {
return nil, err
}