mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-09-04 16:35:44 +00:00
Disallow accidental failing forwarding.
This commit is contained in:
@@ -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
|
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));
|
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) {
|
void MainWidget::finishForwarding(not_null<History*> history) {
|
||||||
auto toForward = history->validateForwardDraft();
|
auto toForward = history->validateForwardDraft();
|
||||||
if (!toForward.empty()) {
|
if (!toForward.empty()) {
|
||||||
|
if (history->peer->slowmodeSecondsLeft()
|
||||||
|
|| (history->peer->slowmodeApplied()
|
||||||
|
&& (toForward.size() > 1
|
||||||
|
|| history->latestSendingMessage() != nullptr))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto options = ApiWrap::SendOptions(history);
|
auto options = ApiWrap::SendOptions(history);
|
||||||
session().api().forwardMessages(std::move(toForward), options);
|
session().api().forwardMessages(std::move(toForward), options);
|
||||||
cancelForwarding(history);
|
cancelForwarding(history);
|
||||||
|
Reference in New Issue
Block a user