Add poll creation to the attach menu.
This commit is contained in:
		
							parent
							
								
									893e14cc39
								
							
						
					
					
						commit
						c257b75a66
					
				
					 1 changed files with 23 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -32,6 +32,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
 | 
			
		|||
#include "ui/painter.h"
 | 
			
		||||
#include "window/themes/window_theme.h"
 | 
			
		||||
#include "window/window_controller.h"
 | 
			
		||||
#include "window/window_peer_menu.h"
 | 
			
		||||
#include "window/window_session_controller.h"
 | 
			
		||||
#include "webview/webview_interface.h"
 | 
			
		||||
#include "core/application.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -1660,6 +1661,28 @@ std::unique_ptr<Ui::DropdownMenu> MakeAttachBotsMenu(
 | 
			
		|||
			attach(false);
 | 
			
		||||
		}, &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()) {
 | 
			
		||||
		if (!bot.inAttachMenu
 | 
			
		||||
			|| !PeerMatchesTypes(peer, bot.user, bot.types)) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue