2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-01 23:15:59 +00:00

Allowing only switch button in inline bot results. 9040124 closed beta.

This commit is contained in:
John Preston
2016-04-10 09:55:48 +04:00
parent fe5e085fb8
commit d960ac2828
4 changed files with 20 additions and 9 deletions

View File

@@ -1931,7 +1931,18 @@ void StickerPanInner::refreshSwitchPmButton(const InlineCacheEntry *entry) {
int StickerPanInner::refreshInlineRows(UserData *bot, const InlineCacheEntry *entry, bool resultsDeleted) {
_inlineBot = bot;
refreshSwitchPmButton(entry);
if (!entry || (entry->results.isEmpty() && (!_inlineBot || _inlineBot->username != cInlineGifBotUsername()))) {
auto clearResults = [this, entry]() {
if (!entry) {
return true;
}
if (entry->results.isEmpty() && entry->switchPmText.isEmpty()) {
if (!_inlineBot || _inlineBot->username != cInlineGifBotUsername()) {
return true;
}
}
return false;
};
if (clearResults()) {
if (resultsDeleted) {
clearInlineRows(true);
}
@@ -3780,7 +3791,7 @@ bool EmojiPan::refreshInlineRows(int32 *added) {
auto i = _inlineCache.constFind(_inlineQuery);
const internal::InlineCacheEntry *entry = nullptr;
if (i != _inlineCache.cend()) {
if (!i.value()->results.isEmpty()) {
if (!i.value()->results.isEmpty() || !i.value()->switchPmText.isEmpty()) {
entry = i.value();
}
_inlineNextOffset = i.value()->nextOffset;