mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 07:33:52 +02:00
Fixed creation of new filter with selected dialog from menu.
This commit is contained in:
parent
f4658728e8
commit
4560a83441
1 changed files with 10 additions and 3 deletions
|
@ -316,16 +316,23 @@ void FillChooseFilterMenu(
|
|||
return;
|
||||
}
|
||||
const auto session = &strong->session();
|
||||
const auto count = session->data().chatsFilters().list().size();
|
||||
if ((count - 1) >= limit()) {
|
||||
const auto &list = session->data().chatsFilters().list();
|
||||
if ((list.size() - 1) >= limit()) {
|
||||
return;
|
||||
}
|
||||
const auto chooseNextId = [&] {
|
||||
auto id = 2;
|
||||
while (ranges::contains(list, id, &Data::ChatFilter::id)) {
|
||||
++id;
|
||||
}
|
||||
return id;
|
||||
};
|
||||
auto filter =
|
||||
Data::ChatFilter({}, {}, {}, {}, {}, { history }, {}, {});
|
||||
const auto send = [=](const Data::ChatFilter &filter) {
|
||||
session->api().request(MTPmessages_UpdateDialogFilter(
|
||||
MTP_flags(MTPmessages_UpdateDialogFilter::Flag::f_filter),
|
||||
MTP_int(count),
|
||||
MTP_int(chooseNextId()),
|
||||
filter.tl()
|
||||
)).done([=] {
|
||||
session->data().chatsFilters().reload();
|
||||
|
|
Loading…
Add table
Reference in a new issue