MM-63205 Revert emoji store methods to return empty arrays instead of nil (#30337)

* MM-63205 Revert emoji store methods to return empty arrays instead of nil

* Update tests for getEmojiList

* Add case to TestGetEmojisByNames

* Update tests for searchEmoji and autocompleteEmoji
Этот коммит содержится в:
Harrison Healey
2025-02-26 15:40:52 -05:00
коммит произвёл GitHub
родитель 9f49403d0a
Коммит 470123125a
2 изменённых файлов: 163 добавлений и 95 удалений

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

@@ -63,7 +63,7 @@ func (es SqlEmojiStore) GetByName(c request.CTX, name string, allowFromCache boo
func (es SqlEmojiStore) GetMultipleByName(c request.CTX, names []string) ([]*model.Emoji, error) {
query := es.emojiSelectQuery.Where(sq.Eq{"Name": names})
var emojis []*model.Emoji
emojis := []*model.Emoji{}
if err := es.DBXFromContext(c.Context()).SelectBuilder(&emojis, query); err != nil {
return nil, errors.Wrapf(err, "error getting emojis by names %v", names)
}
@@ -72,7 +72,7 @@ func (es SqlEmojiStore) GetMultipleByName(c request.CTX, names []string) ([]*mod
}
func (es SqlEmojiStore) GetList(offset, limit int, sort string) ([]*model.Emoji, error) {
var emojis []*model.Emoji
emojis := []*model.Emoji{}
query := es.emojiSelectQuery
if sort == model.EmojiSortByName {
@@ -106,7 +106,7 @@ func (es SqlEmojiStore) Delete(emoji *model.Emoji, time int64) error {
}
func (es SqlEmojiStore) Search(name string, prefixOnly bool, limit int) ([]*model.Emoji, error) {
var emojis []*model.Emoji
emojis := []*model.Emoji{}
name = sanitizeSearchTerm(name, "\\")