2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Delete filter links, edit filter link names.

This commit is contained in:
John Preston
2023-03-28 20:24:54 +04:00
parent 8a9d13c6e4
commit fb16375a19
5 changed files with 117 additions and 39 deletions

View File

@@ -629,6 +629,15 @@ void FilterRowButton::paintEvent(QPaintEvent *e) {
] {
const auto api = &session->api();
const auto filters = &session->data().chatsFilters();
const auto ids = std::make_shared<
base::flat_set<mtpRequestId>
>();
const auto checkFinished = [=] {
if (ids->empty() && next) {
Assert(updated.id() != 0);
next(updated);
}
};
for (const auto &update : updates) {
filters->apply(update);
}
@@ -639,15 +648,16 @@ void FilterRowButton::paintEvent(QPaintEvent *e) {
for (auto &request : requests) {
previousId = api->request(
std::move(request)
).afterRequest(previousId).send();
).done([=](const auto &, mtpRequestId id) {
ids->remove(id);
checkFinished();
}).afterRequest(previousId).send();
ids->emplace(previousId);
}
if (!order.empty() && !addRequests.empty()) {
filters->saveOrder(order, previousId);
}
if (next) {
Assert(updated.id() != 0);
next(updated);
}
checkFinished();
});
};
return [copy = state->save] {