mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Support creating polls from bot keyboards.
This commit is contained in:
@@ -413,6 +413,11 @@ void Filler::addUserActions(not_null<UserData*> user) {
|
||||
tr::lng_profile_invite_to_group(tr::now),
|
||||
[=] { AddBotToGroup::Start(controller, user); });
|
||||
}
|
||||
if (user->canSendPolls()) {
|
||||
_addAction(
|
||||
tr::lng_polls_create(tr::now),
|
||||
[=] { PeerMenuCreatePoll(user); });
|
||||
}
|
||||
if (user->canExportChatHistory()) {
|
||||
_addAction(
|
||||
tr::lng_profile_export_chat(tr::now),
|
||||
@@ -707,12 +712,18 @@ void PeerMenuShareContactBox(
|
||||
}));
|
||||
}
|
||||
|
||||
void PeerMenuCreatePoll(not_null<PeerData*> peer) {
|
||||
void PeerMenuCreatePoll(
|
||||
not_null<PeerData*> peer,
|
||||
PollData::Flags chosen,
|
||||
PollData::Flags disabled) {
|
||||
if (peer->isChannel() && !peer->isMegagroup()) {
|
||||
chosen &= ~PollData::Flag::PublicVotes;
|
||||
disabled |= PollData::Flag::PublicVotes;
|
||||
}
|
||||
const auto box = Ui::show(Box<CreatePollBox>(
|
||||
&peer->session(),
|
||||
((peer->isChannel() && !peer->isMegagroup())
|
||||
? CreatePollBox::PublicVotes::Disabled
|
||||
: CreatePollBox::PublicVotes::Enabled),
|
||||
chosen,
|
||||
disabled,
|
||||
Api::SendType::Normal));
|
||||
const auto lock = box->lifetime().make_state<bool>(false);
|
||||
box->submitRequests(
|
||||
|
Reference in New Issue
Block a user