From 7505a6c6fcf9e215392e047ee70de6e04ccbe55a Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Wed, 30 Jun 2021 16:49:49 +0400 Subject: [PATCH] Hide "via" markup when using gif tab --- Telegram/SourceFiles/api/api_common.h | 1 + Telegram/SourceFiles/apiwrap.cpp | 8 ++++++-- Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/api/api_common.h b/Telegram/SourceFiles/api/api_common.h index 63ee24691..2d69e4844 100644 --- a/Telegram/SourceFiles/api/api_common.h +++ b/Telegram/SourceFiles/api/api_common.h @@ -16,6 +16,7 @@ struct SendOptions { bool silent = false; bool handleSupportSwitch = false; bool removeWebPageId = false; + bool hideVia = false; }; enum class SendType { diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 6f8a6b1aa..e80affd1f 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -4862,7 +4862,11 @@ void ApiWrap::sendInlineResult( sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_silent; } if (bot) { - flags |= MTPDmessage::Flag::f_via_bot_id; + if (action.options.hideVia) { + sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_hide_via; + } else { + flags |= MTPDmessage::Flag::f_via_bot_id; + } } if (action.options.scheduled) { flags |= MTPDmessage::Flag::f_from_scheduled; @@ -4885,7 +4889,7 @@ void ApiWrap::sendInlineResult( newId.msg, messageFromId, MTP_int(HistoryItem::NewMessageDate(action.options.scheduled)), - bot ? peerToUser(bot->id) : 0, + bot && !action.options.hideVia ? peerToUser(bot->id) : 0, action.replyTo, messagePostAuthor); diff --git a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp index 35fe93f55..c56bc1b08 100644 --- a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp @@ -449,6 +449,7 @@ void GifsListWidget::selectInlineResult( forceSend |= (QGuiApplication::keyboardModifiers() == Qt::ControlModifier); + options.hideVia = true; auto item = _rows[row].items[column]; if (const auto photo = item->getPhoto()) { using Data::PhotoSize;