2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Use UserData::isBot where applicable.

This commit is contained in:
John Preston
2019-07-18 10:51:11 +02:00
parent a7d9aa947b
commit 873b77cf40
29 changed files with 105 additions and 95 deletions

View File

@@ -70,7 +70,7 @@ History::History(not_null<Data::Session*> owner, PeerId peerId)
, _mute(owner->notifyIsMuted(peer))
, _sendActionText(st::dialogsTextWidthMin) {
if (const auto user = peer->asUser()) {
if (user->botInfo) {
if (user->isBot()) {
_outboxReadBefore = std::numeric_limits<MsgId>::max();
}
}
@@ -908,7 +908,7 @@ not_null<HistoryItem*> History::addNewItem(
return nullptr;
};
if (auto megagroup = peer->asMegagroup()) {
if (user->botInfo) {
if (user->isBot()) {
auto mgInfo = megagroup->mgInfo.get();
Assert(mgInfo != nullptr);
mgInfo->bots.insert(user);
@@ -1025,7 +1025,7 @@ void History::applyServiceChanges(
Notify::peerUpdatedDelayed(peer, Notify::PeerUpdate::Flag::MembersChanged);
owner().addNewMegagroupParticipant(megagroup, user);
}
if (user->botInfo) {
if (user->isBot()) {
peer->asChannel()->mgInfo->bots.insert(user);
if (peer->asChannel()->mgInfo->botStatus != 0 && peer->asChannel()->mgInfo->botStatus < 2) {
peer->asChannel()->mgInfo->botStatus = 2;
@@ -1047,7 +1047,7 @@ void History::applyServiceChanges(
Notify::peerUpdatedDelayed(peer, Notify::PeerUpdate::Flag::MembersChanged);
owner().addNewMegagroupParticipant(megagroup, user);
}
if (user->botInfo) {
if (user->isBot()) {
mgInfo->bots.insert(user);
if (mgInfo->botStatus != 0 && mgInfo->botStatus < 2) {
mgInfo->botStatus = 2;