mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-05 08:55:59 +00:00
Moved out lambda to jump to near chats filters to static function.
This commit is contained in:
@@ -4893,33 +4893,14 @@ void InnerWidget::setupShortcuts() {
|
||||
});
|
||||
}
|
||||
|
||||
const auto nearFolder = [=](bool isNext) {
|
||||
const auto id = _controller->activeChatsFilterCurrent();
|
||||
const auto list = &session().data().chatsFilters().list();
|
||||
const auto index = int(ranges::find(
|
||||
*list,
|
||||
id,
|
||||
&Data::ChatFilter::id
|
||||
) - begin(*list));
|
||||
if (index == list->size() && id != 0) {
|
||||
return false;
|
||||
}
|
||||
const auto changed = index + (isNext ? 1 : -1);
|
||||
if (changed >= int(list->size()) || changed < 0) {
|
||||
return false;
|
||||
}
|
||||
_controller->setActiveChatsFilter((changed >= 0)
|
||||
? (*list)[changed].id()
|
||||
: 0);
|
||||
return true;
|
||||
};
|
||||
|
||||
request->check(Command::FolderNext) && request->handle([=] {
|
||||
return nearFolder(true);
|
||||
using namespace Window;
|
||||
return CheckAndJumpToNearChatsFilter(_controller, true, true);
|
||||
});
|
||||
|
||||
request->check(Command::FolderPrevious) && request->handle([=] {
|
||||
return nearFolder(false);
|
||||
using namespace Window;
|
||||
return CheckAndJumpToNearChatsFilter(_controller, false, true);
|
||||
});
|
||||
|
||||
request->check(Command::ReadChat) && request->handle([=] {
|
||||
|
Reference in New Issue
Block a user