Fix Ctrl+[1-5] jump to pinned in folders.
This commit is contained in:
parent
6022fa790e
commit
d5b8fc703e
|
@ -1003,7 +1003,7 @@ void ApiWrap::requestPinnedDialogs(Data::Folder *folder) {
|
|||
result.match([&](const MTPDmessages_peerDialogs &data) {
|
||||
_session->data().processUsers(data.vusers());
|
||||
_session->data().processChats(data.vchats());
|
||||
_session->data().clearPinnedChats(folder, FilterId());
|
||||
_session->data().clearPinnedChats(folder);
|
||||
_session->data().applyDialogs(
|
||||
folder,
|
||||
data.vmessages().v,
|
||||
|
|
|
@ -1557,8 +1557,6 @@ void Session::applyDialog(
|
|||
int Session::pinnedChatsCount(
|
||||
Data::Folder *folder,
|
||||
FilterId filterId) const {
|
||||
Expects(!folder || !filterId);
|
||||
|
||||
if (!filterId) {
|
||||
return pinnedChatsOrder(folder, filterId).size();
|
||||
}
|
||||
|
@ -1591,7 +1589,7 @@ const std::vector<Dialogs::Key> &Session::pinnedChatsOrder(
|
|||
return list->pinned()->order();
|
||||
}
|
||||
|
||||
void Session::clearPinnedChats(Data::Folder *folder, FilterId filterId) {
|
||||
void Session::clearPinnedChats(Data::Folder *folder) {
|
||||
chatsList(folder)->pinned()->clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -371,7 +371,7 @@ public:
|
|||
const Dialogs::Key &key,
|
||||
FilterId filterId,
|
||||
bool pinned);
|
||||
void clearPinnedChats(Data::Folder *folder, FilterId filterId);
|
||||
void clearPinnedChats(Data::Folder *folder);
|
||||
void applyPinnedChats(
|
||||
Data::Folder *folder,
|
||||
const QVector<MTPDialogPeer> &list);
|
||||
|
|
|
@ -2999,11 +2999,18 @@ void InnerWidget::setupShortcuts() {
|
|||
Command::ChatPinned4,
|
||||
Command::ChatPinned5,
|
||||
};
|
||||
auto &&pinned = ranges::view::zip(kPinned, ranges::view::ints(0, ranges::unreachable));
|
||||
auto &&pinned = ranges::view::zip(
|
||||
kPinned,
|
||||
ranges::view::ints(0, ranges::unreachable));
|
||||
for (const auto [command, index] : pinned) {
|
||||
request->check(command) && request->handle([=, index = index] {
|
||||
const auto list = session().data().chatsList()->indexed();
|
||||
const auto count = Dialogs::PinnedDialogsCount(_filterId, list);
|
||||
const auto list = (_filterId
|
||||
? session().data().chatsFilters().chatsList(_filterId)
|
||||
: session().data().chatsList()
|
||||
)->indexed();
|
||||
const auto count = Dialogs::PinnedDialogsCount(
|
||||
_filterId,
|
||||
list);
|
||||
if (index >= count) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue