diff --git a/Telegram/Resources/scheme.tl b/Telegram/Resources/scheme.tl index 0ffdab97e..30b38e0b7 100644 --- a/Telegram/Resources/scheme.tl +++ b/Telegram/Resources/scheme.tl @@ -214,7 +214,7 @@ fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileL fileLocation#91d11eb dc_id:int volume_id:long local_id:int secret:long file_reference:bytes = FileLocation; userEmpty#200250ba id:int = User; -user#2e13f4c3 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?string bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User; +user#2e13f4c3 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?string bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User; userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto; userProfilePhoto#d559d8c8 photo_id:long photo_small:FileLocation photo_big:FileLocation = UserProfilePhoto; @@ -1419,7 +1419,7 @@ phone.saveCallDebug#277add7e peer:InputPhoneCall debug:DataJSON = Bool; langpack.getLangPack#f2f2330a lang_pack:string lang_code:string = LangPackDifference; langpack.getStrings#efea3803 lang_pack:string lang_code:string keys:Vector = Vector; -langpack.getDifference#9d51e814 lang_code:string from_version:int = LangPackDifference; +langpack.getDifference#cd984aa5 lang_pack:string lang_code:string from_version:int = LangPackDifference; langpack.getLanguages#42c6978f lang_pack:string = Vector; langpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLanguage; diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index fbd6fa3fa..371b10042 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -2065,7 +2065,7 @@ void ApiWrap::unblockUser(not_null user) { )).done([=](const MTPBool &result) { _blockRequests.erase(user); user->setBlockStatus(UserData::BlockStatus::NotBlocked); - if (user->botInfo) { + if (user->isBot() && !user->isSupport()) { sendBotStart(user); } }).fail([=](const RPCError &error) { @@ -2645,7 +2645,7 @@ void ApiWrap::requestAttachedStickerSets(not_null photo) { }); }); - const auto setId = (setData->vid.v && setData->vaccess_hash.v) + const auto setId = (setData->vid.v && setData->vaccess_hash.v) ? MTP_inputStickerSetID(setData->vid, setData->vaccess_hash) : MTP_inputStickerSetShortName(setData->vshort_name); Ui::show( diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index 7fc24c80a..7db50373b 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -396,10 +396,10 @@ namespace App { user->setContactStatus(UserData::ContactStatus::CanAdd); } - const auto showPhone = !isServiceUser(user->id) + const auto showPhone = !user->isServiceUser() && !user->isSelf() && user->contactStatus() == UserData::ContactStatus::CanAdd; - const auto showPhoneChanged = !isServiceUser(user->id) + const auto showPhoneChanged = !user->isServiceUser() && !user->isSelf() && (showPhone != wasShowPhone); if (showPhoneChanged) { diff --git a/Telegram/SourceFiles/boxes/background_preview_box.cpp b/Telegram/SourceFiles/boxes/background_preview_box.cpp index 3b368bfe7..d41e71a1f 100644 --- a/Telegram/SourceFiles/boxes/background_preview_box.cpp +++ b/Telegram/SourceFiles/boxes/background_preview_box.cpp @@ -391,12 +391,12 @@ BackgroundPreviewBox::BackgroundPreviewBox( const Data::WallPaper &paper) : _text1(GenerateTextItem( this, - Auth().data().history(peerFromUser(ServiceUserId)), + Auth().data().history(peerFromUser(PeerData::kServiceNotificationsId)), lang(lng_background_text1), false)) , _text2(GenerateTextItem( this, - Auth().data().history(peerFromUser(ServiceUserId)), + Auth().data().history(peerFromUser(PeerData::kServiceNotificationsId)), lang(lng_background_text2), true)) , _paper(paper) diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h index 4ec78f7e8..28b74fe82 100644 --- a/Telegram/SourceFiles/config.h +++ b/Telegram/SourceFiles/config.h @@ -63,7 +63,6 @@ enum { SetOnlineAfterActivity = 30, // user with hidden last seen stays online for such amount of seconds in the interface - ServiceUserId = 777000, WebPageUserId = 701000, UpdateDelayConstPart = 8 * 3600, // 8 hour min time between update check requests @@ -74,14 +73,6 @@ enum { ChoosePeerByDragTimeout = 1000, // 1 second mouse not moved to choose dialog when dragging a file }; -inline bool isNotificationsUser(uint64 id) { - return (id == 333000) || (id == ServiceUserId); -} - -inline bool isServiceUser(uint64 id) { - return !(id % 1000);// (id == 333000) || (id == ServiceUserId); -} - #ifdef Q_OS_WIN inline const GUID &cGUID() { #ifndef OS_MAC_STORE diff --git a/Telegram/SourceFiles/data/data_peer.cpp b/Telegram/SourceFiles/data/data_peer.cpp index a12c82e11..eeeff590a 100644 --- a/Telegram/SourceFiles/data/data_peer.cpp +++ b/Telegram/SourceFiles/data/data_peer.cpp @@ -314,7 +314,7 @@ void PeerData::clearUserpic() { const auto photoId = PhotoId(0); const auto loc = StorageImageLocation(); const auto photo = [&] { - if (id == peerFromUser(ServiceUserId)) { + if (isNotificationsUser()) { auto image = Core::App().logoNoMargin().scaledToWidth( kUserpicSize, Qt::SmoothTransformation); diff --git a/Telegram/SourceFiles/data/data_peer.h b/Telegram/SourceFiles/data/data_peer.h index e38a7b448..89fea98d8 100644 --- a/Telegram/SourceFiles/data/data_peer.h +++ b/Telegram/SourceFiles/data/data_peer.h @@ -107,6 +107,8 @@ protected: public: virtual ~PeerData(); + static constexpr auto kServiceNotificationsId = peerFromUser(777000); + [[nodiscard]] Data::Session &owner() const; [[nodiscard]] AuthSession &session() const; @@ -125,6 +127,14 @@ public: [[nodiscard]] bool isVerified() const; [[nodiscard]] bool isMegagroup() const; + [[nodiscard]] bool isNotificationsUser() const { + return (id == peerFromUser(333000)) + || (id == kServiceNotificationsId); + } + [[nodiscard]] bool isServiceUser() const { + return isUser() && !(id % 1000); + } + [[nodiscard]] std::optional notifyMuteUntil() const { return _notify.muteUntil(); } diff --git a/Telegram/SourceFiles/data/data_peer_values.cpp b/Telegram/SourceFiles/data/data_peer_values.cpp index 36172c27f..0accf6bf7 100644 --- a/Telegram/SourceFiles/data/data_peer_values.cpp +++ b/Telegram/SourceFiles/data/data_peer_values.cpp @@ -43,11 +43,13 @@ int OnlinePhraseChangeInSeconds(TimeId online, TimeId now) { } std::optional OnlineTextSpecial(not_null user) { - if (isNotificationsUser(user->id)) { + if (user->isNotificationsUser()) { return lang(lng_status_service_notifications); - } else if (user->botInfo) { + } else if (user->isSupport()) { + return lang(lng_status_support); + } else if (user->isBot()) { return lang(lng_status_bot); - } else if (isServiceUser(user->id)) { + } else if (user->isServiceUser()) { return lang(lng_status_support); } return std::nullopt; @@ -247,7 +249,7 @@ rpl::producer CanWriteValue(not_null peer) { } TimeId SortByOnlineValue(not_null user, TimeId now) { - if (isServiceUser(user->id) || user->botInfo) { + if (user->isServiceUser() || user->isBot()) { return -1; } const auto online = user->onlineTill; @@ -283,7 +285,7 @@ crl::time OnlineChangeTimeout(TimeId online, TimeId now) { } crl::time OnlineChangeTimeout(not_null user, TimeId now) { - if (isServiceUser(user->id) || user->botInfo) { + if (user->isServiceUser() || user->botInfo) { return kMaxOnlineChangeTimeout; } return OnlineChangeTimeout(user->onlineTill, now); @@ -358,7 +360,7 @@ bool OnlineTextActive(TimeId online, TimeId now) { } bool OnlineTextActive(not_null user, TimeId now) { - if (isServiceUser(user->id) || user->botInfo) { + if (user->isServiceUser() || user->botInfo) { return false; } return OnlineTextActive(user->onlineTill, now); diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index 76bf9726e..14547d58b 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -313,11 +313,12 @@ not_null Session::processUser(const MTPUser &data) { const auto nameChanged = (result->firstName != fname) || (result->lastName != lname); - auto showPhone = !isServiceUser(result->id) + auto showPhone = !result->isServiceUser() + && !data.is_support() && !data.is_self() && !data.is_contact() && !data.is_mutual_contact(); - auto showPhoneChanged = !isServiceUser(result->id) + auto showPhoneChanged = !result->isServiceUser() && !data.is_self() && ((showPhone && result->contactStatus() == UserData::ContactStatus::Contact) @@ -325,7 +326,7 @@ not_null Session::processUser(const MTPUser &data) { && result->contactStatus() == UserData::ContactStatus::CanAdd)); if (minimal) { showPhoneChanged = false; - showPhone = !isServiceUser(result->id) + showPhone = !result->isServiceUser() && (result->id != _session->userPeerId()) && (result->contactStatus() == UserData::ContactStatus::CanAdd); } @@ -2959,14 +2960,14 @@ void Session::serviceNotification( const TextWithEntities &message, const MTPMessageMedia &media) { const auto date = unixtime(); - if (!userLoaded(ServiceUserId)) { + if (!peerLoaded(PeerData::kServiceNotificationsId)) { processUser(MTP_user( MTP_flags( MTPDuser::Flag::f_first_name | MTPDuser::Flag::f_phone | MTPDuser::Flag::f_status | MTPDuser::Flag::f_verified), - MTP_int(ServiceUserId), + MTP_int(peerToUser(PeerData::kServiceNotificationsId)), MTPlong(), MTP_string("Telegram"), MTPstring(), @@ -2979,7 +2980,7 @@ void Session::serviceNotification( MTPstring(), MTPstring())); } - const auto history = this->history(peerFromUser(ServiceUserId)); + const auto history = this->history(PeerData::kServiceNotificationsId); if (!history->lastMessageKnown()) { _session->api().requestDialogEntry(history, [=] { insertCheckedServiceNotification(message, media, date); @@ -3001,7 +3002,7 @@ void Session::insertCheckedServiceNotification( const TextWithEntities &message, const MTPMessageMedia &media, TimeId date) { - const auto history = this->history(peerFromUser(ServiceUserId)); + const auto history = this->history(PeerData::kServiceNotificationsId); if (!history->isReadyFor(ShowAtUnreadMsgId)) { history->setUnreadCount(0); history->getReadyFor(ShowAtTheEndMsgId); @@ -3016,7 +3017,7 @@ void Session::insertCheckedServiceNotification( MTP_message( MTP_flags(flags), MTP_int(clientMsgId()), - MTP_int(ServiceUserId), + MTP_int(peerToUser(PeerData::kServiceNotificationsId)), MTP_peerUser(MTP_int(_session->userId())), MTPnullFwdHeader, MTPint(), diff --git a/Telegram/SourceFiles/data/data_types.h b/Telegram/SourceFiles/data/data_types.h index 9f8de5a00..a47007b1a 100644 --- a/Telegram/SourceFiles/data/data_types.h +++ b/Telegram/SourceFiles/data/data_types.h @@ -138,43 +138,43 @@ constexpr auto PeerIdUserShift = PeerId(0x000000000ULL); constexpr auto PeerIdChatShift = PeerId(0x100000000ULL); constexpr auto PeerIdChannelShift = PeerId(0x200000000ULL); -inline bool peerIsUser(const PeerId &id) { +inline constexpr bool peerIsUser(const PeerId &id) { return (id & PeerIdTypeMask) == PeerIdUserShift; } -inline bool peerIsChat(const PeerId &id) { +inline constexpr bool peerIsChat(const PeerId &id) { return (id & PeerIdTypeMask) == PeerIdChatShift; } -inline bool peerIsChannel(const PeerId &id) { +inline constexpr bool peerIsChannel(const PeerId &id) { return (id & PeerIdTypeMask) == PeerIdChannelShift; } -inline PeerId peerFromUser(UserId user_id) { +inline constexpr PeerId peerFromUser(UserId user_id) { return PeerIdUserShift | uint64(uint32(user_id)); } -inline PeerId peerFromChat(ChatId chat_id) { +inline constexpr PeerId peerFromChat(ChatId chat_id) { return PeerIdChatShift | uint64(uint32(chat_id)); } -inline PeerId peerFromChannel(ChannelId channel_id) { +inline constexpr PeerId peerFromChannel(ChannelId channel_id) { return PeerIdChannelShift | uint64(uint32(channel_id)); } -inline PeerId peerFromUser(const MTPint &user_id) { +inline constexpr PeerId peerFromUser(const MTPint &user_id) { return peerFromUser(user_id.v); } -inline PeerId peerFromChat(const MTPint &chat_id) { +inline constexpr PeerId peerFromChat(const MTPint &chat_id) { return peerFromChat(chat_id.v); } -inline PeerId peerFromChannel(const MTPint &channel_id) { +inline constexpr PeerId peerFromChannel(const MTPint &channel_id) { return peerFromChannel(channel_id.v); } -inline int32 peerToBareInt(const PeerId &id) { +inline constexpr int32 peerToBareInt(const PeerId &id) { return int32(uint32(id & PeerIdMask)); } -inline UserId peerToUser(const PeerId &id) { +inline constexpr UserId peerToUser(const PeerId &id) { return peerIsUser(id) ? peerToBareInt(id) : 0; } -inline ChatId peerToChat(const PeerId &id) { +inline constexpr ChatId peerToChat(const PeerId &id) { return peerIsChat(id) ? peerToBareInt(id) : 0; } -inline ChannelId peerToChannel(const PeerId &id) { +inline constexpr ChannelId peerToChannel(const PeerId &id) { return peerIsChannel(id) ? peerToBareInt(id) : NoChannel; } inline MTPint peerToBareMTPInt(const PeerId &id) { diff --git a/Telegram/SourceFiles/data/data_user.cpp b/Telegram/SourceFiles/data/data_user.cpp index f59d125a2..acecd1830 100644 --- a/Telegram/SourceFiles/data/data_user.cpp +++ b/Telegram/SourceFiles/data/data_user.cpp @@ -210,9 +210,9 @@ void UserData::setNameOrPhone(const QString &newNameOrPhone) { } void UserData::madeAction(TimeId when) { - if (botInfo || isServiceUser(id) || when <= 0) return; - - if (onlineTill <= 0 && -onlineTill < when) { + if (isBot() || isServiceUser() || when <= 0) { + return; + } else if (onlineTill <= 0 && -onlineTill < when) { onlineTill = -when - SetOnlineAfterActivity; Notify::peerUpdatedDelayed(this, Notify::PeerUpdate::Flag::UserOnlineChanged); } else if (onlineTill > 0 && onlineTill < when + 1) { diff --git a/Telegram/SourceFiles/data/data_user.h b/Telegram/SourceFiles/data/data_user.h index a3ce0713b..a2bc54b2d 100644 --- a/Telegram/SourceFiles/data/data_user.h +++ b/Telegram/SourceFiles/data/data_user.h @@ -125,6 +125,9 @@ public: bool isBot() const { return botInfo != nullptr; } + bool isSupport() const { + return flags() & MTPDuser::Flag::f_support; + } bool isInaccessible() const { constexpr auto inaccessible = 0 | MTPDuser::Flag::f_deleted; diff --git a/Telegram/SourceFiles/dialogs/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/dialogs_layout.cpp index bea418ad8..465124954 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_layout.cpp @@ -29,6 +29,10 @@ namespace { // Show all dates that are in the last 20 hours in time format. constexpr int kRecentlyInSeconds = 20 * 3600; +bool ShowUserBotIcon(not_null user) { + return user->isBot() && !user->isSupport(); +} + void paintRowTopRight(Painter &p, const QString &text, QRect &rectForName, bool active, bool selected) { const auto width = st::dialogsDateFont->width(text); rectForName.setWidth(rectForName.width() - width - st::dialogsDateSkip); @@ -38,21 +42,23 @@ void paintRowTopRight(Painter &p, const QString &text, QRect &rectForName, bool } void paintRowDate(Painter &p, QDateTime date, QRect &rectForName, bool active, bool selected) { - auto now = QDateTime::currentDateTime(); - auto lastTime = date; - auto nowDate = now.date(); - auto lastDate = lastTime.date(); + const auto now = QDateTime::currentDateTime(); + const auto &lastTime = date; + const auto nowDate = now.date(); + const auto lastDate = lastTime.date(); - QString dt; - bool wasSameDay = (lastDate == nowDate); - bool wasRecently = qAbs(lastTime.secsTo(now)) < kRecentlyInSeconds; - if (wasSameDay || wasRecently) { - dt = lastTime.toString(cTimeFormat()); - } else if (lastDate.year() == nowDate.year() && lastDate.weekNumber() == nowDate.weekNumber()) { - dt = langDayOfWeek(lastDate); - } else { - dt = lastDate.toString(qsl("d.MM.yy")); - } + const auto dt = [&] { + const auto wasSameDay = (lastDate == nowDate); + const auto wasRecently = qAbs(lastTime.secsTo(now)) < kRecentlyInSeconds; + if (wasSameDay || wasRecently) { + return lastTime.toString(cTimeFormat()); + } else if (lastDate.year() == nowDate.year() + && lastDate.weekNumber() == nowDate.weekNumber()) { + return langDayOfWeek(lastDate); + } else { + return lastDate.toString(qsl("d.MM.yy")); + } + }(); paintRowTopRight(p, dt, rectForName, active, selected); } @@ -434,7 +440,7 @@ const style::icon *ChatTypeIcon( ? st::dialogsChannelIconOver : st::dialogsChannelIcon)); } else if (const auto user = peer->asUser()) { - if (user->isBot()) { + if (ShowUserBotIcon(user)) { return &(active ? st::dialogsBotIconActive : (selected diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index 2b6065a9f..851d3a6a0 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -2427,7 +2427,7 @@ bool History::clearUnreadOnClientSide() const { } bool History::skipUnreadUpdateForClientSideUnread() const { - if (peer->id != peerFromUser(ServiceUserId)) { + if (peer->id != PeerData::kServiceNotificationsId) { return false; } else if (!_unreadCount || !*_unreadCount) { return false; diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 188736989..70f70ef10 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -1605,9 +1605,11 @@ void HistoryWidget::showHistory( } if (_peer) { - _unblock->setText(lang(_peer->isUser() && _peer->asUser()->botInfo - ? lng_restart_button - : lng_unblock_button).toUpper()); + _unblock->setText(lang((_peer->isUser() + && _peer->asUser()->isBot() + && !_peer->asUser()->isSupport()) + ? lng_restart_button + : lng_unblock_button).toUpper()); if (const auto channel = _peer->asChannel()) { channel->updateFull(); _joinChannel->setText(lang(channel->isMegagroup() @@ -1789,7 +1791,10 @@ bool HistoryWidget::contentOverlapped(const QRect &globalRect) { } void HistoryWidget::updateReportSpamStatus() { - if (!_peer || (_peer->isUser() && (_peer->id == Auth().userPeerId() || isNotificationsUser(_peer->id) || isServiceUser(_peer->id) || _peer->asUser()->botInfo))) { + if (!_peer + || (_peer->id == Auth().userPeerId()) + || _peer->isServiceUser() + || (_peer->isUser() && _peer->asUser()->isBot())) { setReportSpamStatus(dbiprsHidden); return; } else if (!_firstLoadRequest && _history->isEmpty()) { diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index 74adea552..05c9f7e58 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -558,12 +558,12 @@ void ActionsFiller::addBotCommandActions(not_null user) { } void ActionsFiller::addReportAction() { - auto peer = _peer; + const auto peer = _peer; AddActionButton( _wrap, Lang::Viewer(lng_profile_report), rpl::single(true), - [peer] { Ui::show(Box(peer)); }, + [=] { Ui::show(Box(peer)); }, st::infoBlockButton); } @@ -574,12 +574,12 @@ void ActionsFiller::addBlockAction(not_null user) { ) | rpl::map([user] { switch (user->blockStatus()) { case UserData::BlockStatus::Blocked: - return Lang::Viewer(user->botInfo + return Lang::Viewer((user->isBot() && !user->isSupport()) ? lng_profile_restart_bot : lng_profile_unblock_user); case UserData::BlockStatus::NotBlocked: default: - return Lang::Viewer(user->botInfo + return Lang::Viewer((user->isBot() && !user->isSupport()) ? lng_profile_block_bot : lng_profile_block_user); } @@ -659,7 +659,7 @@ void ActionsFiller::fillUserActions(not_null user) { _wrap->add(CreateSkipWidget( _wrap, st::infoBlockButtonSkip)); - if (user->botInfo) { + if (user->isBot() && !user->isSupport()) { addReportAction(); } addBlockAction(user); diff --git a/Telegram/SourceFiles/lang/lang_cloud_manager.cpp b/Telegram/SourceFiles/lang/lang_cloud_manager.cpp index cd0a9bd18..0689e7335 100644 --- a/Telegram/SourceFiles/lang/lang_cloud_manager.cpp +++ b/Telegram/SourceFiles/lang/lang_cloud_manager.cpp @@ -233,6 +233,7 @@ void CloudManager::requestLangPackDifference(Pack pack) { } if (version > 0) { packRequestId(pack) = request(MTPlangpack_GetDifference( + MTP_string(CloudLangPackName()), MTP_string(code), MTP_int(version) )).done([=](const MTPLangPackDifference &result) { diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index cc083b92a..020b09c2c 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -1700,7 +1700,7 @@ void MainWidget::choosePeer(PeerId peerId, MsgId showAtMsgId) { } void MainWidget::clearBotStartToken(PeerData *peer) { - if (peer && peer->isUser() && peer->asUser()->botInfo) { + if (peer && peer->isUser() && peer->asUser()->isBot()) { peer->asUser()->botInfo->startToken = QString(); } } @@ -4358,7 +4358,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { user->firstName, user->lastName, ((user->contactStatus() == UserData::ContactStatus::Contact - || isServiceUser(user->id) + || user->isServiceUser() || user->isSelf() || user->phone().isEmpty()) ? QString() diff --git a/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp b/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp index 08963084d..53c637c63 100644 --- a/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp +++ b/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp @@ -219,7 +219,7 @@ bool BlockedBoxController::prependRow(not_null user) { std::unique_ptr BlockedBoxController::createRow( not_null user) const { auto row = std::make_unique(user); - row->setActionLink(lang(user->botInfo + row->setActionLink(lang((user->isBot() && !user->isSupport()) ? lng_blocked_list_restart : lng_blocked_list_unblock)); const auto status = [&] { diff --git a/Telegram/SourceFiles/storage/serialize_common.cpp b/Telegram/SourceFiles/storage/serialize_common.cpp index 8d905e4fa..e40f0cc8b 100644 --- a/Telegram/SourceFiles/storage/serialize_common.cpp +++ b/Telegram/SourceFiles/storage/serialize_common.cpp @@ -174,7 +174,7 @@ PeerData *readPeer(int streamAppVersion, QDataStream &stream) { } stream >> onlineTill >> contact >> botInfoVersion; - const auto showPhone = !isServiceUser(user->id) + const auto showPhone = !user->isServiceUser() && (user->id != Auth().userPeerId()) && (contact <= 0); const auto pname = (showPhone && !phone.isEmpty()) diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 48156dc84..e3c859f62 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -275,10 +275,10 @@ void Filler::addToggleUnreadMark() { void Filler::addBlockUser(not_null user) { auto blockText = [](not_null user) { return lang(user->isBlocked() - ? (user->botInfo + ? ((user->isBot() && !user->isSupport()) ? lng_profile_restart_bot : lng_profile_unblock_user) - : (user->botInfo + : ((user->isBot() && !user->isSupport()) ? lng_profile_block_bot : lng_profile_block_user)); };