MM-43878: don't err when reply createAt before parent createAt (#20292)

Summary
In a bulk import, if the createAt of a reply is older than the createAt of the parent post, then instead of erroring, we log a warning and set the createAt of the reply to that of the parent post.
I checked the exporting logic, there doesn't appear to be away for the reply createAt to be older than the parent createAt, as a side-effect of the exporting logic.

Ticket Link
https://mattermost.atlassian.net/browse/MM-43878
Этот коммит содержится в:
Ashish Bhate
2022-05-27 15:48:00 +05:30
коммит произвёл GitHub
родитель 84dbf894ea
Коммит c5e6d0e1ba
5 изменённых файлов: 48 добавлений и 13 удалений

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

@@ -11,6 +11,7 @@ import (
"unicode/utf8"
"github.com/mattermost/mattermost-server/v6/model"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
func validateSchemeImportData(data *SchemeImportData) *model.AppError {
@@ -412,7 +413,7 @@ func validateReplyImportData(data *ReplyImportData, parentCreateAt int64, maxPos
} else if *data.CreateAt == 0 {
return model.NewAppError("BulkImport", "app.import.validate_reply_import_data.create_at_zero.error", nil, "", http.StatusBadRequest)
} else if *data.CreateAt < parentCreateAt {
return model.NewAppError("BulkImport", "app.import.validate_reply_import_data.create_at_before_parent.error", nil, "", http.StatusBadRequest)
mlog.Warn("Reply CreateAt is before parent post CreateAt", mlog.Int64("reply_create_at", *data.CreateAt), mlog.Int64("parent_create_at", parentCreateAt))
}
return nil