mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 02:01:40 -05:00
parent
bdfb9b4143
commit
193e454fd4
4 changed files with 25 additions and 1 deletions
|
@ -5437,6 +5437,11 @@ void ApiWrap::createPoll(
|
|||
if (options.replyTo) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to_msg_id;
|
||||
}
|
||||
if (options.clearDraft) {
|
||||
sendFlags |= MTPmessages_SendMedia::Flag::f_clear_draft;
|
||||
history->clearLocalDraft();
|
||||
history->clearCloudDraft();
|
||||
}
|
||||
const auto channelPost = peer->isChannel() && !peer->isMegagroup();
|
||||
const auto silentPost = channelPost
|
||||
&& _session->data().notifySilentPosts(peer);
|
||||
|
|
|
@ -1118,6 +1118,15 @@ bool MainWidget::historyInSelectionMode() const {
|
|||
return _history->inSelectionMode();
|
||||
}
|
||||
|
||||
MsgId MainWidget::currentReplyToIdFor(not_null<History*> history) const {
|
||||
if (_history->history() == history) {
|
||||
return _history->replyToId();
|
||||
} else if (const auto localDraft = history->localDraft()) {
|
||||
return localDraft->msgId;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MainWidget::sendBotCommand(PeerData *peer, UserData *bot, const QString &cmd, MsgId replyTo) {
|
||||
_history->sendBotCommand(peer, bot, cmd, replyTo);
|
||||
}
|
||||
|
|
|
@ -217,6 +217,8 @@ public:
|
|||
TimeMs highlightStartTime(not_null<const HistoryItem*> item) const;
|
||||
bool historyInSelectionMode() const;
|
||||
|
||||
MsgId currentReplyToIdFor(not_null<History*> history) const;
|
||||
|
||||
void sendBotCommand(PeerData *peer, UserData *bot, const QString &cmd, MsgId replyTo);
|
||||
void hideSingleUseKeyboard(PeerData *peer, MsgId replyTo);
|
||||
bool insertBotCommand(const QString &cmd);
|
||||
|
|
|
@ -35,6 +35,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_poll.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_drafts.h"
|
||||
#include "data/data_user.h"
|
||||
#include "dialogs/dialogs_key.h"
|
||||
|
||||
|
@ -636,7 +637,14 @@ void PeerMenuCreatePoll(not_null<PeerData*> peer) {
|
|||
if (std::exchange(*lock, true)) {
|
||||
return;
|
||||
}
|
||||
const auto options = ApiWrap::SendOptions(peer->owner().history(peer));
|
||||
auto options = ApiWrap::SendOptions(peer->owner().history(peer));
|
||||
if (const auto id = App::main()->currentReplyToIdFor(options.history)) {
|
||||
options.replyTo = id;
|
||||
}
|
||||
if (const auto localDraft = options.history->localDraft()) {
|
||||
options.clearDraft = localDraft->textWithTags.text.isEmpty();
|
||||
}
|
||||
|
||||
Auth().api().createPoll(result, options, crl::guard(box, [=] {
|
||||
box->closeBox();
|
||||
}), crl::guard(box, [=](const RPCError &error) {
|
||||
|
|
Loading…
Add table
Reference in a new issue