2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-02 15:35:51 +00:00

Apply faved stickers limit when faving.

This commit is contained in:
John Preston
2017-08-15 17:34:30 +03:00
parent a72453fb1b
commit 81fb32504b
3 changed files with 96 additions and 79 deletions

View File

@@ -826,21 +826,19 @@ void MediaPreviewWidget::hidePreview() {
}
void MediaPreviewWidget::fillEmojiString() {
_emojiList.clear();
if (_photo) {
_emojiList.clear();
} else if (auto sticker = _document->sticker()) {
_emojiList = Stickers::GetEmojiListFromSet(_document);
if (_emojiList.empty()) {
if (auto emoji = Ui::Emoji::Find(sticker->alt)) {
_emojiList.push_back(emoji);
}
} else {
return;
}
if (auto sticker = _document->sticker()) {
if (auto list = Stickers::GetEmojiListFromSet(_document)) {
_emojiList = std::move(*list);
while (_emojiList.size() > kStickerPreviewEmojiLimit) {
_emojiList.pop_back();
}
} else if (auto emoji = Ui::Emoji::Find(sticker->alt)) {
_emojiList.push_back(emoji);
}
} else {
_emojiList.clear();
}
}