mirror of https://github.com/procxx/kepka.git
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) {
|
if (!keyboardBotFound) {
|
||||||
h->clearLastKeyboard();
|
h->clearLastKeyboard();
|
||||||
if (App::main()) App::main()->updateBotKeyboard(h);
|
|
||||||
}
|
}
|
||||||
int newMembersCount = qMax(d.vcount.v, v.count());
|
int newMembersCount = qMax(d.vcount.v, v.count());
|
||||||
if (newMembersCount > peer->membersCount()) {
|
if (newMembersCount > peer->membersCount()) {
|
||||||
|
|
|
@ -858,7 +858,6 @@ namespace {
|
||||||
chat->botStatus = botStatus;
|
chat->botStatus = botStatus;
|
||||||
if (!found) {
|
if (!found) {
|
||||||
h->clearLastKeyboard();
|
h->clearLastKeyboard();
|
||||||
if (App::main()) App::main()->updateBotKeyboard(h);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -961,7 +960,6 @@ namespace {
|
||||||
History *h = App::historyLoaded(chat->id);
|
History *h = App::historyLoaded(chat->id);
|
||||||
if (h && h->lastKeyboardFrom == user->id) {
|
if (h && h->lastKeyboardFrom == user->id) {
|
||||||
h->clearLastKeyboard();
|
h->clearLastKeyboard();
|
||||||
if (App::main()) App::main()->updateBotKeyboard(h);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (chat->botStatus > 0 && user->botInfo) {
|
if (chat->botStatus > 0 && user->botInfo) {
|
||||||
|
|
|
@ -151,6 +151,9 @@ void History::clearLastKeyboard() {
|
||||||
lastKeyboardHiddenId = 0;
|
lastKeyboardHiddenId = 0;
|
||||||
}
|
}
|
||||||
lastKeyboardId = 0;
|
lastKeyboardId = 0;
|
||||||
|
if (auto main = App::main()) {
|
||||||
|
main->updateBotKeyboard(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
lastKeyboardInited = true;
|
lastKeyboardInited = true;
|
||||||
lastKeyboardFrom = 0;
|
lastKeyboardFrom = 0;
|
||||||
|
@ -839,7 +842,6 @@ HistoryItem *History::createItem(const MTPMessage &msg, bool applyServiceAction,
|
||||||
PeerId uid = peerFromUser(d.vuser_id);
|
PeerId uid = peerFromUser(d.vuser_id);
|
||||||
if (lastKeyboardFrom == uid) {
|
if (lastKeyboardFrom == uid) {
|
||||||
clearLastKeyboard();
|
clearLastKeyboard();
|
||||||
if (App::main()) App::main()->updateBotKeyboard(this);
|
|
||||||
}
|
}
|
||||||
if (peer->isMegagroup()) {
|
if (peer->isMegagroup()) {
|
||||||
if (auto user = App::userLoaded(uid)) {
|
if (auto user = App::userLoaded(uid)) {
|
||||||
|
@ -2719,7 +2721,6 @@ void HistoryItem::finishEditionToEmpty() {
|
||||||
}
|
}
|
||||||
if (history()->lastKeyboardId == id) {
|
if (history()->lastKeyboardId == id) {
|
||||||
history()->clearLastKeyboard();
|
history()->clearLastKeyboard();
|
||||||
if (App::main()) App::main()->updateBotKeyboard(history());
|
|
||||||
}
|
}
|
||||||
if ((!out() || isPost()) && unread() && history()->unreadCount() > 0) {
|
if ((!out() || isPost()) && unread() && history()->unreadCount() > 0) {
|
||||||
history()->setUnreadCount(history()->unreadCount() - 1);
|
history()->setUnreadCount(history()->unreadCount() - 1);
|
||||||
|
@ -2767,7 +2768,6 @@ void HistoryItem::destroy() {
|
||||||
}
|
}
|
||||||
if (history()->lastKeyboardId == id) {
|
if (history()->lastKeyboardId == id) {
|
||||||
history()->clearLastKeyboard();
|
history()->clearLastKeyboard();
|
||||||
if (App::main()) App::main()->updateBotKeyboard(history());
|
|
||||||
}
|
}
|
||||||
if ((!out() || isPost()) && unread() && history()->unreadCount() > 0) {
|
if ((!out() || isPost()) && unread() && history()->unreadCount() > 0) {
|
||||||
history()->setUnreadCount(history()->unreadCount() - 1);
|
history()->setUnreadCount(history()->unreadCount() - 1);
|
||||||
|
|
|
@ -5930,8 +5930,9 @@ void HistoryWidget::onKbToggle(bool manual) {
|
||||||
} else {
|
} else {
|
||||||
if (_history) {
|
if (_history) {
|
||||||
_history->clearLastKeyboard();
|
_history->clearLastKeyboard();
|
||||||
|
} else {
|
||||||
|
updateBotKeyboard();
|
||||||
}
|
}
|
||||||
updateBotKeyboard();
|
|
||||||
}
|
}
|
||||||
} else if (!_keyboard.hasMarkup() && _keyboard.forceReply()) {
|
} else if (!_keyboard.hasMarkup() && _keyboard.forceReply()) {
|
||||||
_kbHide.hide();
|
_kbHide.hide();
|
||||||
|
|
|
@ -447,7 +447,7 @@ void MembersWidget::fillMegagroupMembers(ChannelData *megagroup) {
|
||||||
t_assert(megagroup->mgInfo != nullptr);
|
t_assert(megagroup->mgInfo != nullptr);
|
||||||
if (megagroup->mgInfo->lastParticipants.isEmpty()) return;
|
if (megagroup->mgInfo->lastParticipants.isEmpty()) return;
|
||||||
|
|
||||||
if (!megagroup->amIn()) {
|
if (!megagroup->canViewMembers()) {
|
||||||
_list.clear();
|
_list.clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -458,7 +458,9 @@ void MembersWidget::fillMegagroupMembers(ChannelData *megagroup) {
|
||||||
if (_sortByOnline) {
|
if (_sortByOnline) {
|
||||||
_list.clear();
|
_list.clear();
|
||||||
_list.reserve(membersList.size());
|
_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()) {
|
} else if (membersList.size() >= _list.size()) {
|
||||||
if (addUsersToEnd(megagroup)) {
|
if (addUsersToEnd(megagroup)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -72,7 +72,11 @@ void TopBarWidget::onInfoClicked() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TopBarWidget::onSearch() {
|
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) {
|
void TopBarWidget::enterEvent(QEvent *e) {
|
||||||
|
@ -246,11 +250,11 @@ void TopBarWidget::updateMembersShowArea() {
|
||||||
if (_selCount || App::main()->overviewPeer() || !_selPeer) {
|
if (_selCount || App::main()->overviewPeer() || !_selPeer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (_selPeer->isChat()) {
|
if (auto chat = _selPeer->asChat()) {
|
||||||
return true;
|
return chat->amIn();
|
||||||
}
|
}
|
||||||
if (_selPeer->isMegagroup()) {
|
if (auto megagroup = _selPeer->asMegagroup()) {
|
||||||
return (_selPeer->asMegagroup()->membersCount() < Global::ChatSizeMax());
|
return megagroup->canViewMembers() && (megagroup->membersCount() < Global::ChatSizeMax());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue