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 удалений

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

@@ -1118,6 +1118,10 @@ func (a *App) importReplies(c *request.Context, data []ReplyImportData, post *mo
reply.RootId = post.Id
reply.Message = *replyData.Message
reply.CreateAt = *replyData.CreateAt
if reply.CreateAt < post.CreateAt {
mlog.Warn("Reply CreateAt is before parent post CreateAt, setting it to parent post CreateAt", mlog.Int64("reply_create_at", reply.CreateAt), mlog.Int64("parent_create_at", post.CreateAt))
reply.CreateAt = post.CreateAt
}
if replyData.Type != nil {
reply.Type = *replyData.Type
}