Fix draft clearing on message send.

Regression was introduced in caef7dde24.
This commit is contained in:
John Preston 2019-08-30 13:17:18 +03:00
parent f199205592
commit 5758f756c9
6 changed files with 7 additions and 4 deletions

View File

@ -28,7 +28,7 @@ struct SendAction {
not_null<History*> history;
SendOptions options;
MsgId replyTo = 0;
bool clearDraft = false;
bool clearDraft = true;
bool generateLocal = true;
};

View File

@ -114,6 +114,7 @@ void activateBotCommand(
Ui::show(Box<ConfirmBox>(tr::lng_bot_share_phone(tr::now), tr::lng_bot_share_phone_confirm(tr::now), [=] {
Ui::showPeerHistory(history, ShowAtTheEndMsgId);
auto action = Api::SendAction(history);
action.clearDraft = false;
action.replyTo = msgId;
history->session().api().shareContact(
history->session().user(),

View File

@ -5547,7 +5547,6 @@ void HistoryWidget::sendInlineResult(
}
auto action = Api::SendAction(_history);
action.clearDraft = true;
action.replyTo = replyToId();
action.generateLocal = true;
session().api().sendInlineResult(bot, result, action);

View File

@ -512,7 +512,6 @@ void ScheduledWidget::sendInlineResult(
not_null<UserData*> bot,
Api::SendOptions options) {
auto action = Api::SendAction(_history);
action.clearDraft = true;
//action.replyTo = replyToId();
action.options = options;
action.generateLocal = true;

View File

@ -604,7 +604,7 @@ QString InterpretSendPath(const QString &path) {
return "App Error: Could not find channel with id: " + QString::number(peerToChannel(toId));
}
Ui::showPeerHistory(history, ShowAtUnreadMsgId);
Auth().api().sendFiles(
history->session().api().sendFiles(
Storage::PrepareMediaList(QStringList(filePath), st::sendMediaPreviewSize),
SendMediaType::File,
{ caption },

View File

@ -669,6 +669,7 @@ void PeerMenuShareContactBox(
return;
} else if (peer->isSelf()) {
auto action = Api::SendAction(peer->owner().history(peer));
action.clearDraft = false;
user->session().api().shareContact(user, action);
Ui::Toast::Show(tr::lng_share_done(tr::now));
if (auto strong = *weak) {
@ -686,6 +687,7 @@ void PeerMenuShareContactBox(
const auto history = peer->owner().history(peer);
Ui::showPeerHistory(history, ShowAtTheEndMsgId);
auto action = Api::SendAction(history);
action.clearDraft = false;
user->session().api().shareContact(user, action);
}), LayerOption::KeepOther);
};
@ -711,6 +713,7 @@ void PeerMenuCreatePoll(not_null<PeerData*> peer) {
return;
}
auto action = Api::SendAction(peer->owner().history(peer));
action.clearDraft = false;
action.options = result.options;
if (const auto id = App::main()->currentReplyToIdFor(action.history)) {
action.replyTo = id;
@ -827,6 +830,7 @@ QPointer<Ui::RpWidget> ShowForwardMessagesBox(
if (!items.empty()) {
const auto api = &peer->session().api();
auto action = Api::SendAction(peer->owner().history(peer));
action.clearDraft = false;
action.generateLocal = false;
api->forwardMessages(std::move(items), action, [] {
Ui::Toast::Show(tr::lng_share_done(tr::now));