Fix saving filters.

This commit is contained in:
John Preston 2020-03-18 14:25:41 +04:00
parent ffc65f7da4
commit 4b618aeb6c
1 changed files with 3 additions and 3 deletions

View File

@ -476,13 +476,13 @@ void ManageFiltersPrepare::SetupBox(
} }
return localId; return localId;
}; };
auto result = base::flat_map<FilterId, FilterId>(); auto result = base::flat_map<not_null<FilterRowButton*>, FilterId>();
for (auto &row : *rows) { for (auto &row : *rows) {
const auto id = row.filter.id(); const auto id = row.filter.id();
if (row.removed) { if (row.removed) {
continue; continue;
} else if (!ranges::contains(list, id, &Data::ChatFilter::id)) { } else if (!ranges::contains(list, id, &Data::ChatFilter::id)) {
result.emplace(row.filter.id(), chooseNextId()); result.emplace(row.button, chooseNextId());
} }
} }
return result; return result;
@ -506,7 +506,7 @@ void ManageFiltersPrepare::SetupBox(
order.push_back(MTP_int(id)); order.push_back(MTP_int(id));
continue; continue;
} }
const auto newId = ids.take(id).value_or(id); const auto newId = ids.take(row.button).value_or(id);
const auto tl = removed const auto tl = removed
? MTPDialogFilter() ? MTPDialogFilter()
: row.filter.tl(newId); : row.filter.tl(newId);