2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Fix resetting all sessions.

This commit is contained in:
John Preston
2020-12-15 18:23:41 +04:00
parent 6b5c422e95
commit 00fac70140
2 changed files with 15 additions and 8 deletions

View File

@@ -125,13 +125,20 @@ void Authorizations::requestTerminate(
Fn<void(const MTPBool &result)> &&done,
Fn<void(const RPCError &error)> &&fail,
std::optional<uint64> hash) {
auto request = hash
? MTPaccount_ResetAuthorization(MTP_long(*hash))
: MTPaccount_ResetAuthorization();
_api.request(std::move(request))
.done(std::move(done))
.fail(std::move(fail))
.send();
const auto send = [&](auto request) {
_api.request(
std::move(request)
).done(
std::move(done)
).fail(
std::move(fail)
).send();
};
if (hash) {
send(MTPaccount_ResetAuthorization(MTP_long(*hash)));
} else {
send(MTPauth_ResetAuthorizations());
}
}
Authorizations::List Authorizations::list() const {