mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Fix confirmation when joining by link.
This commit is contained in:
parent
1db1328a91
commit
5708b5e849
1 changed files with 26 additions and 29 deletions
|
@ -240,15 +240,34 @@ void ChooseJoinAsProcess::start(
|
|||
if (list.empty()) {
|
||||
_request->showToast(Lang::Hard::ServerError());
|
||||
return;
|
||||
} else if (!changingJoinAsFrom
|
||||
&& list.size() == 1
|
||||
&& list.front() == self
|
||||
}
|
||||
info.joinAs = [&]() -> not_null<PeerData*> {
|
||||
const auto loaded = selectedId
|
||||
? session->data().peerLoaded(selectedId)
|
||||
: nullptr;
|
||||
return (changingJoinAsFrom
|
||||
&& ranges::contains(list, not_null{ changingJoinAsFrom }))
|
||||
? not_null(changingJoinAsFrom)
|
||||
: (loaded && ranges::contains(list, not_null{ loaded }))
|
||||
? not_null(loaded)
|
||||
: ranges::contains(list, self)
|
||||
? self
|
||||
: list.front();
|
||||
}();
|
||||
info.possibleJoinAs = std::move(list);
|
||||
|
||||
const auto onlyByMe = (info.possibleJoinAs.size() == 1)
|
||||
&& (info.possibleJoinAs.front() == self)
|
||||
&& (!peer->isChannel()
|
||||
|| !peer->asChannel()->amAnonymous()
|
||||
|| (peer->isBroadcast() && !peer->canWrite()))) {
|
||||
info.possibleJoinAs = std::move(list);
|
||||
if (context != Context::JoinWithConfirm
|
||||
|| (selectedId && self->id == selectedId)) {
|
||||
|| (peer->isBroadcast() && !peer->canWrite()));
|
||||
|
||||
// We already joined this voice chat, just rejoin with the same.
|
||||
const auto byAlreadyUsed = selectedId
|
||||
&& (info.joinAs->id == selectedId);
|
||||
|
||||
if (!changingJoinAsFrom && (onlyByMe || byAlreadyUsed)) {
|
||||
if (context != Context::JoinWithConfirm) {
|
||||
finish(info);
|
||||
return;
|
||||
}
|
||||
|
@ -273,28 +292,6 @@ void ChooseJoinAsProcess::start(
|
|||
_request->showBox(std::move(box));
|
||||
return;
|
||||
}
|
||||
info.joinAs = [&]() -> not_null<PeerData*> {
|
||||
const auto loaded = selectedId
|
||||
? session->data().peerLoaded(selectedId)
|
||||
: nullptr;
|
||||
return (changingJoinAsFrom
|
||||
&& ranges::contains(list, not_null{ changingJoinAsFrom }))
|
||||
? not_null(changingJoinAsFrom)
|
||||
: (loaded && ranges::contains(list, not_null{ loaded }))
|
||||
? not_null(loaded)
|
||||
: ranges::contains(list, self)
|
||||
? self
|
||||
: list.front();
|
||||
}();
|
||||
info.possibleJoinAs = std::move(list);
|
||||
|
||||
if (!changingJoinAsFrom
|
||||
&& selectedId
|
||||
&& info.joinAs->id == selectedId) {
|
||||
// We already joined this voice chat, just rejoin with the same.
|
||||
finish(info);
|
||||
return;
|
||||
}
|
||||
auto box = Box(
|
||||
ChooseJoinAsBox,
|
||||
context,
|
||||
|
|
Loading…
Add table
Reference in a new issue