mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +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(
|
||||
|
@@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "data/data_poll.h"
|
||||
|
||||
class History;
|
||||
|
||||
namespace Ui {
|
||||
@@ -58,7 +60,10 @@ void PeerMenuAddChannelMembers(
|
||||
not_null<Window::SessionNavigation*> navigation,
|
||||
not_null<ChannelData*> channel);
|
||||
//void PeerMenuUngroupFeed(not_null<Data::Feed*> feed); // #feed
|
||||
void PeerMenuCreatePoll(not_null<PeerData*> peer);
|
||||
void PeerMenuCreatePoll(
|
||||
not_null<PeerData*> peer,
|
||||
PollData::Flags chosen = PollData::Flags(),
|
||||
PollData::Flags disabled = PollData::Flags());
|
||||
void PeerMenuBlockUserBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
not_null<Window::Controller*> window,
|
||||
|
Reference in New Issue
Block a user