[MM-53245] export/import: add Props to the replies (#29531)

Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2024-12-18 17:36:17 +01:00
коммит произвёл GitHub
родитель f60694dbef
Коммит bf4d41954a
5 изменённых файлов: 27 добавлений и 4 удалений

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

@@ -183,10 +183,11 @@ type ReactionImportData struct {
type ReplyImportData struct {
User *string `json:"user"`
Type *string `json:"type"`
Message *string `json:"message"`
CreateAt *int64 `json:"create_at"`
EditAt *int64 `json:"edit_at"`
Type *string `json:"type"`
Message *string `json:"message"`
Props *model.StringInterface `json:"props"`
CreateAt *int64 `json:"create_at"`
EditAt *int64 `json:"edit_at"`
FlaggedBy *[]string `json:"flagged_by,omitempty"`
Reactions *[]ReactionImportData `json:"reactions,omitempty"`

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

@@ -474,6 +474,19 @@ func ValidateReplyImportData(data *ReplyImportData, parentCreateAt int64, maxPos
mlog.Warn("Reply CreateAt is before parent post CreateAt", mlog.Int("reply_create_at", *data.CreateAt), mlog.Int("parent_create_at", parentCreateAt))
}
if data.Props != nil && utf8.RuneCountInString(model.StringInterfaceToJSON(*data.Props)) > model.PostPropsMaxRunes {
return model.NewAppError("BulkImport", "app.import.validate_post_import_data.props_too_large.error", nil, "", http.StatusBadRequest)
}
if data.Reactions != nil {
for _, reaction := range *data.Reactions {
reaction := reaction
if err := ValidateReactionImportData(&reaction, *data.CreateAt); err != nil {
return err
}
}
}
return nil
}