mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 23:27:09 +02:00
Fix resetting all sessions.
This commit is contained in:
parent
6b5c422e95
commit
00fac70140
2 changed files with 15 additions and 8 deletions
|
@ -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 {
|
||||
|
|
|
@ -292,7 +292,7 @@ void SessionsContent::terminateAll() {
|
|||
auto callback = [=] {
|
||||
const auto reset = crl::guard(weak, [=] {
|
||||
_authorizations->cancelCurrentRequest();
|
||||
shortPollSessions();
|
||||
_authorizations->reload();
|
||||
});
|
||||
_authorizations->requestTerminate(
|
||||
[=](const MTPBool &result) { reset(); },
|
||||
|
|
Loading…
Add table
Reference in a new issue