MM-49564: Drafts upsert in the Store vs App layer (#22530)
* MM-49564: Upsert in the Store vs App layer Refactor drafts so that Upserting a draft would happen in the DB and not in the app layer. * Fixes mocks * Fixes tests * Fixes translations * Fixes tests * Update tests * Fixes tests * Addresses review comments - renames Save => Upsert - removes Sleep from tests * Fixes flaky test --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
@@ -81,9 +81,11 @@ func (o *Draft) GetProps() StringInterface {
|
||||
func (o *Draft) PreSave() {
|
||||
if o.CreateAt == 0 {
|
||||
o.CreateAt = GetMillis()
|
||||
o.UpdateAt = o.CreateAt
|
||||
} else {
|
||||
o.UpdateAt = GetMillis()
|
||||
}
|
||||
|
||||
o.UpdateAt = o.CreateAt
|
||||
o.DeleteAt = 0
|
||||
o.PreCommit()
|
||||
}
|
||||
@@ -100,8 +102,3 @@ func (o *Draft) PreCommit() {
|
||||
// There's a rare bug where the client sends up duplicate FileIds so protect against that
|
||||
o.FileIds = RemoveDuplicateStrings(o.FileIds)
|
||||
}
|
||||
|
||||
func (o *Draft) PreUpdate() {
|
||||
o.UpdateAt = GetMillis()
|
||||
o.PreCommit()
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user