mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-27 09:03:02 +00:00
parent
4d495b8d7c
commit
e397f72eb2
@ -629,12 +629,17 @@ void PeerMenuShareContactBox(not_null<UserData*> user) {
|
||||
|
||||
void PeerMenuCreatePoll(not_null<PeerData*> peer) {
|
||||
const auto box = Ui::show(Box<CreatePollBox>());
|
||||
const auto lock = box->lifetime().make_state<bool>(false);
|
||||
box->submitRequests(
|
||||
) | rpl::start_with_next([=](const PollData &result) {
|
||||
if (std::exchange(*lock, true)) {
|
||||
return;
|
||||
}
|
||||
const auto options = ApiWrap::SendOptions(App::history(peer));
|
||||
Auth().api().createPoll(result, options, crl::guard(box, [=] {
|
||||
box->closeBox();
|
||||
}), crl::guard(box, [=](const RPCError &error) {
|
||||
*lock = false;
|
||||
box->submitFailed(lang(lng_attach_failed));
|
||||
}));
|
||||
}, box->lifetime());
|
||||
|
Loading…
Reference in New Issue
Block a user