Fix channel creation flow.

This commit is contained in:
John Preston 2023-02-15 10:14:50 +04:00
parent 3573b84e8b
commit 91e6c42fcf

View file

@ -140,6 +140,19 @@ void MustBePublicFailed(
MustBePublicDestroy(channel); MustBePublicDestroy(channel);
} }
[[nodiscard]] Fn<void(not_null<PeerData*>)> WrapPeerDoneFromChannelDone(
Fn<void(not_null<ChannelData*>)> channelDone) {
if (!channelDone) {
return nullptr;
}
return [=](not_null<PeerData*> peer) {
if (const auto channel = peer->asChannel()) {
const auto onstack = channelDone;
onstack(channel);
}
};
}
} // namespace } // namespace
TextWithEntities PeerFloodErrorText( TextWithEntities PeerFloodErrorText(
@ -482,13 +495,7 @@ GroupInfoBox::GroupInfoBox(
, _api(&_navigation->session().mtp()) , _api(&_navigation->session().mtp())
, _type(type) , _type(type)
, _initialTitle(title) , _initialTitle(title)
, _done([channelDone = std::move(channelDone)](not_null<PeerData*> peer) { , _done(WrapPeerDoneFromChannelDone(std::move(channelDone))) {
if (const auto channel = peer->asChannel()) {
if (const auto onstack = channelDone) {
onstack(channel);
}
}
}) {
} }
GroupInfoBox::GroupInfoBox( GroupInfoBox::GroupInfoBox(