mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-25 04:38:23 +00:00
Disallow accidental failing forwarding.
This commit is contained in:
parent
c50ade565a
commit
234b0ffcf0
Telegram/SourceFiles
@ -3224,7 +3224,11 @@ void HistoryWidget::stopRecording(bool send) {
|
||||
}
|
||||
|
||||
void HistoryWidget::sendBotCommand(PeerData *peer, UserData *bot, const QString &cmd, MsgId replyTo) { // replyTo != 0 from ReplyKeyboardMarkup, == 0 from cmd links
|
||||
if (!_peer || _peer != peer) return;
|
||||
if (!_peer || _peer != peer) {
|
||||
return;
|
||||
} else if (showSlowmodeError()) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool lastKeyboardUsed = (_keyboard->forMsgId() == FullMsgId(_channel, _history->lastKeyboardId)) && (_keyboard->forMsgId() == FullMsgId(_channel, replyTo));
|
||||
|
||||
|
@ -681,6 +681,13 @@ void MainWidget::cancelForwarding(not_null<History*> history) {
|
||||
void MainWidget::finishForwarding(not_null<History*> history) {
|
||||
auto toForward = history->validateForwardDraft();
|
||||
if (!toForward.empty()) {
|
||||
if (history->peer->slowmodeSecondsLeft()
|
||||
|| (history->peer->slowmodeApplied()
|
||||
&& (toForward.size() > 1
|
||||
|| history->latestSendingMessage() != nullptr))) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto options = ApiWrap::SendOptions(history);
|
||||
session().api().forwardMessages(std::move(toForward), options);
|
||||
cancelForwarding(history);
|
||||
|
Loading…
Reference in New Issue
Block a user