Skip and warn on emoji import when name conflicts with system emoji (#19516)

This changes import behavior related to emoji imports when the name
conflicts with the name of a system emoji. Previously, the import
would fail, but now a warning is logged and the conflicting emoji
is skipped.
Этот коммит содержится в:
Gabe Jackson
2022-02-08 10:20:34 -05:00
коммит произвёл GitHub
родитель 40f48432a6
Коммит 03d059bd2a
6 изменённых файлов: 55 добавлений и 34 удалений

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

@@ -1813,8 +1813,13 @@ func (a *App) importMultipleDirectPostLines(c *request.Context, lines []LineImpo
}
func (a *App) importEmoji(data *EmojiImportData, dryRun bool) *model.AppError {
if err := validateEmojiImportData(data); err != nil {
return err
aerr := validateEmojiImportData(data)
if aerr != nil {
if aerr.Id == "model.emoji.system_emoji_name.app_error" {
mlog.Warn("Skipping emoji import due to name conflict with system emoji", mlog.String("emoji_name", *data.Name))
return nil
}
return aerr
}
// If this is a Dry Run, do not continue any further.