mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-09 16:47:26 +00:00
Megagroup members are always shown if the server allows us to view them.
Bot keyboard clearing fixed when using Clear History.
This commit is contained in:
parent
207981b8c4
commit
1753db3e62
@ -543,7 +543,6 @@ void ApiWrap::lastParticipantsDone(ChannelData *peer, const MTPchannels_ChannelP
|
||||
}
|
||||
if (!keyboardBotFound) {
|
||||
h->clearLastKeyboard();
|
||||
if (App::main()) App::main()->updateBotKeyboard(h);
|
||||
}
|
||||
int newMembersCount = qMax(d.vcount.v, v.count());
|
||||
if (newMembersCount > peer->membersCount()) {
|
||||
|
@ -858,7 +858,6 @@ namespace {
|
||||
chat->botStatus = botStatus;
|
||||
if (!found) {
|
||||
h->clearLastKeyboard();
|
||||
if (App::main()) App::main()->updateBotKeyboard(h);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -961,7 +960,6 @@ namespace {
|
||||
History *h = App::historyLoaded(chat->id);
|
||||
if (h && h->lastKeyboardFrom == user->id) {
|
||||
h->clearLastKeyboard();
|
||||
if (App::main()) App::main()->updateBotKeyboard(h);
|
||||
}
|
||||
}
|
||||
if (chat->botStatus > 0 && user->botInfo) {
|
||||
|
@ -151,6 +151,9 @@ void History::clearLastKeyboard() {
|
||||
lastKeyboardHiddenId = 0;
|
||||
}
|
||||
lastKeyboardId = 0;
|
||||
if (auto main = App::main()) {
|
||||
main->updateBotKeyboard(this);
|
||||
}
|
||||
}
|
||||
lastKeyboardInited = true;
|
||||
lastKeyboardFrom = 0;
|
||||
@ -839,7 +842,6 @@ HistoryItem *History::createItem(const MTPMessage &msg, bool applyServiceAction,
|
||||
PeerId uid = peerFromUser(d.vuser_id);
|
||||
if (lastKeyboardFrom == uid) {
|
||||
clearLastKeyboard();
|
||||
if (App::main()) App::main()->updateBotKeyboard(this);
|
||||
}
|
||||
if (peer->isMegagroup()) {
|
||||
if (auto user = App::userLoaded(uid)) {
|
||||
@ -2719,7 +2721,6 @@ void HistoryItem::finishEditionToEmpty() {
|
||||
}
|
||||
if (history()->lastKeyboardId == id) {
|
||||
history()->clearLastKeyboard();
|
||||
if (App::main()) App::main()->updateBotKeyboard(history());
|
||||
}
|
||||
if ((!out() || isPost()) && unread() && history()->unreadCount() > 0) {
|
||||
history()->setUnreadCount(history()->unreadCount() - 1);
|
||||
@ -2767,7 +2768,6 @@ void HistoryItem::destroy() {
|
||||
}
|
||||
if (history()->lastKeyboardId == id) {
|
||||
history()->clearLastKeyboard();
|
||||
if (App::main()) App::main()->updateBotKeyboard(history());
|
||||
}
|
||||
if ((!out() || isPost()) && unread() && history()->unreadCount() > 0) {
|
||||
history()->setUnreadCount(history()->unreadCount() - 1);
|
||||
|
@ -5930,8 +5930,9 @@ void HistoryWidget::onKbToggle(bool manual) {
|
||||
} else {
|
||||
if (_history) {
|
||||
_history->clearLastKeyboard();
|
||||
} else {
|
||||
updateBotKeyboard();
|
||||
}
|
||||
updateBotKeyboard();
|
||||
}
|
||||
} else if (!_keyboard.hasMarkup() && _keyboard.forceReply()) {
|
||||
_kbHide.hide();
|
||||
|
@ -447,7 +447,7 @@ void MembersWidget::fillMegagroupMembers(ChannelData *megagroup) {
|
||||
t_assert(megagroup->mgInfo != nullptr);
|
||||
if (megagroup->mgInfo->lastParticipants.isEmpty()) return;
|
||||
|
||||
if (!megagroup->amIn()) {
|
||||
if (!megagroup->canViewMembers()) {
|
||||
_list.clear();
|
||||
return;
|
||||
}
|
||||
@ -458,7 +458,9 @@ void MembersWidget::fillMegagroupMembers(ChannelData *megagroup) {
|
||||
if (_sortByOnline) {
|
||||
_list.clear();
|
||||
_list.reserve(membersList.size());
|
||||
addUser(megagroup, App::self())->onlineForSort = INT_MAX;
|
||||
if (megagroup->amIn()) {
|
||||
addUser(megagroup, App::self())->onlineForSort = INT_MAX;
|
||||
}
|
||||
} else if (membersList.size() >= _list.size()) {
|
||||
if (addUsersToEnd(megagroup)) {
|
||||
return;
|
||||
|
@ -72,7 +72,11 @@ void TopBarWidget::onInfoClicked() {
|
||||
}
|
||||
|
||||
void TopBarWidget::onSearch() {
|
||||
Shortcuts::launch(qsl("search"));
|
||||
if (auto main = App::main()) {
|
||||
if (auto peer = main->peer()) {
|
||||
main->searchInPeer(peer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TopBarWidget::enterEvent(QEvent *e) {
|
||||
@ -246,11 +250,11 @@ void TopBarWidget::updateMembersShowArea() {
|
||||
if (_selCount || App::main()->overviewPeer() || !_selPeer) {
|
||||
return false;
|
||||
}
|
||||
if (_selPeer->isChat()) {
|
||||
return true;
|
||||
if (auto chat = _selPeer->asChat()) {
|
||||
return chat->amIn();
|
||||
}
|
||||
if (_selPeer->isMegagroup()) {
|
||||
return (_selPeer->asMegagroup()->membersCount() < Global::ChatSizeMax());
|
||||
if (auto megagroup = _selPeer->asMegagroup()) {
|
||||
return megagroup->canViewMembers() && (megagroup->membersCount() < Global::ChatSizeMax());
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user