2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-18 13:59:46 +00:00

Show correct state of "Accept calls" checkbox.

This commit is contained in:
John Preston
2023-03-01 12:52:50 +04:00
parent d18c6591e9
commit 856c537335
3 changed files with 16 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ Authorizations::Entry ParseEntry(const MTPDauthorization &data) {
result.hash = data.is_current() ? 0 : data.vhash().v;
result.incomplete = data.is_password_pending();
result.callsDisabled = data.is_call_requests_disabled();
const auto apiId = result.apiId = data.vapi_id().v;
const auto isTest = (apiId == TestApiId);
@@ -135,6 +136,7 @@ void Authorizations::reload() {
) | ranges::views::transform([](const MTPAuthorization &d) {
return ParseEntry(d.c_authorization());
}) | ranges::to<List>;
refreshCallsDisabledHereFromCloud();
_listChanges.fire({});
});
}).fail([=] {
@@ -146,6 +148,14 @@ void Authorizations::cancelCurrentRequest() {
_api.request(base::take(_requestId)).cancel();
}
void Authorizations::refreshCallsDisabledHereFromCloud() {
const auto that = ranges::find(_list, 0, &Entry::hash);
if (that != end(_list)
&& !_toggleCallsDisabledRequests.contains(0)) {
_callsDisabledHere = that->callsDisabled;
}
}
void Authorizations::requestTerminate(
Fn<void(const MTPBool &result)> &&done,
Fn<void(const MTP::Error &error)> &&fail,