From b364cbbd69eb2decbd2a3411d2e706de472f1f55 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 3 Apr 2019 16:14:05 +0400 Subject: [PATCH] Improve support accounts presentation. - Change "Bot Info" to "User Info". - Remove "Block user" and "Add to Group" buttons from profile page. - Allow revoking messages from support chats. --- Telegram/SourceFiles/history/history_item.cpp | 2 +- Telegram/SourceFiles/info/info_top_bar.cpp | 6 +++--- Telegram/SourceFiles/info/profile/info_profile_actions.cpp | 6 +++--- Telegram/SourceFiles/info/profile/info_profile_values.cpp | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 930bbcbd18..a3f2f2eacc 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -493,7 +493,7 @@ bool HistoryItem::canDeleteForEveryone(TimeId now) const { } else if (const auto user = peer->asUser()) { // Bots receive all messages and there is no sense in revoking them. // See https://github.com/telegramdesktop/tdesktop/issues/3818 - if (user->botInfo) { + if (user->isBot() && !user->isSupport()) { return false; } } diff --git a/Telegram/SourceFiles/info/info_top_bar.cpp b/Telegram/SourceFiles/info/info_top_bar.cpp index 4fb6bd6dd7..57b73ee198 100644 --- a/Telegram/SourceFiles/info/info_top_bar.cpp +++ b/Telegram/SourceFiles/info/info_top_bar.cpp @@ -556,11 +556,11 @@ rpl::producer TitleValue( case Section::Type::Profile: if (const auto feed = key.feed()) { return lng_info_feed_title; - } else if (auto user = peer->asUser()) { - return user->botInfo + } else if (const auto user = peer->asUser()) { + return (user->isBot() && !user->isSupport()) ? lng_info_bot_title : lng_info_user_title; - } else if (auto channel = peer->asChannel()) { + } else if (const auto channel = peer->asChannel()) { return channel->isMegagroup() ? lng_info_group_title : lng_info_channel_title; diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index 05c9f7e58c..865f47c5fc 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -652,14 +652,14 @@ void ActionsFiller::fillUserActions(not_null user) { } addClearHistoryAction(user); addDeleteConversationAction(user); - if (!user->isSelf()) { - if (user->botInfo) { + if (!user->isSelf() && !user->isSupport()) { + if (user->isBot()) { addBotCommandActions(user); } _wrap->add(CreateSkipWidget( _wrap, st::infoBlockButtonSkip)); - if (user->isBot() && !user->isSupport()) { + if (user->isBot()) { addReportAction(); } addBlockAction(user); diff --git a/Telegram/SourceFiles/info/profile/info_profile_values.cpp b/Telegram/SourceFiles/info/profile/info_profile_values.cpp index bab3820101..b75c65cf40 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_values.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_values.cpp @@ -136,7 +136,7 @@ rpl::producer IsContactValue(not_null user) { } rpl::producer CanInviteBotToGroupValue(not_null user) { - if (!user->botInfo) { + if (!user->isBot() || user->isSupport()) { return rpl::single(false); } return Notify::PeerUpdateValue(