Add poll creation to the attach menu.
This commit is contained in:
parent
893e14cc39
commit
c257b75a66
|
@ -32,6 +32,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/painter.h"
|
#include "ui/painter.h"
|
||||||
#include "window/themes/window_theme.h"
|
#include "window/themes/window_theme.h"
|
||||||
#include "window/window_controller.h"
|
#include "window/window_controller.h"
|
||||||
|
#include "window/window_peer_menu.h"
|
||||||
#include "window/window_session_controller.h"
|
#include "window/window_session_controller.h"
|
||||||
#include "webview/webview_interface.h"
|
#include "webview/webview_interface.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
|
@ -1660,6 +1661,28 @@ std::unique_ptr<Ui::DropdownMenu> MakeAttachBotsMenu(
|
||||||
attach(false);
|
attach(false);
|
||||||
}, &st::menuIconFile);
|
}, &st::menuIconFile);
|
||||||
}
|
}
|
||||||
|
if (peer->canCreatePolls()) {
|
||||||
|
++minimal;
|
||||||
|
raw->addAction(tr::lng_polls_create(tr::now), [=] {
|
||||||
|
const auto action = actionFactory();
|
||||||
|
const auto source = action.options.scheduled
|
||||||
|
? Api::SendType::Scheduled
|
||||||
|
: Api::SendType::Normal;
|
||||||
|
const auto sendMenuType = action.replyTo.topicRootId
|
||||||
|
? SendMenu::Type::SilentOnly
|
||||||
|
: SendMenu::Type::Scheduled;
|
||||||
|
const auto flag = PollData::Flags();
|
||||||
|
const auto replyTo = action.replyTo;
|
||||||
|
Window::PeerMenuCreatePoll(
|
||||||
|
controller,
|
||||||
|
peer,
|
||||||
|
replyTo,
|
||||||
|
flag,
|
||||||
|
flag,
|
||||||
|
source,
|
||||||
|
sendMenuType);
|
||||||
|
}, &st::menuIconCreatePoll);
|
||||||
|
}
|
||||||
for (const auto &bot : bots->attachBots()) {
|
for (const auto &bot : bots->attachBots()) {
|
||||||
if (!bot.inAttachMenu
|
if (!bot.inAttachMenu
|
||||||
|| !PeerMatchesTypes(peer, bot.user, bot.types)) {
|
|| !PeerMatchesTypes(peer, bot.user, bot.types)) {
|
||||||
|
|
Loading…
Reference in New Issue