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

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

@@ -78,9 +78,12 @@ func (emoji *Emoji) IsValid() *AppError {
}
func IsValidEmojiName(name string) *AppError {
if name == "" || len(name) > EmojiNameMaxLength || !IsValidAlphaNumHyphenUnderscorePlus(name) || inSystemEmoji(name) {
if name == "" || len(name) > EmojiNameMaxLength || !IsValidAlphaNumHyphenUnderscorePlus(name) {
return NewAppError("Emoji.IsValid", "model.emoji.name.app_error", nil, "", http.StatusBadRequest)
}
if inSystemEmoji(name) {
return NewAppError("Emoji.IsValid", "model.emoji.system_emoji_name.app_error", nil, "", http.StatusBadRequest)
}
return nil
}