mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 22:46:10 +00:00
Fix webview switch_inline to the same chat.
This commit is contained in:
@@ -354,7 +354,12 @@ MainWidget::MainWidget(
|
||||
session().changes().entryUpdates(
|
||||
Data::EntryUpdate::Flag::LocalDraftSet
|
||||
) | rpl::start_with_next([=](const Data::EntryUpdate &update) {
|
||||
controller->showThread(update.entry->asThread(), ShowAtUnreadMsgId);
|
||||
auto params = Window::SectionShow();
|
||||
params.reapplyLocalDraft = true;
|
||||
controller->showThread(
|
||||
update.entry->asThread(),
|
||||
ShowAtUnreadMsgId,
|
||||
params);
|
||||
controller->hideLayer();
|
||||
}, lifetime());
|
||||
|
||||
@@ -609,37 +614,6 @@ bool MainWidget::shareUrl(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MainWidget::inlineSwitchChosen(
|
||||
not_null<Data::Thread*> thread,
|
||||
const QString &botAndQuery) const {
|
||||
if (!Data::CanSend(thread, ChatRestriction::SendInline)) {
|
||||
_controller->show(Ui::MakeInformBox(tr::lng_inline_switch_cant()));
|
||||
return false;
|
||||
}
|
||||
const auto textWithTags = TextWithTags{
|
||||
botAndQuery,
|
||||
TextWithTags::Tags(),
|
||||
};
|
||||
const auto cursor = MessageCursor{
|
||||
int(botAndQuery.size()),
|
||||
int(botAndQuery.size()),
|
||||
QFIXED_MAX
|
||||
};
|
||||
const auto history = thread->owningHistory();
|
||||
const auto topicRootId = thread->topicRootId();
|
||||
history->setLocalDraft(std::make_unique<Data::Draft>(
|
||||
textWithTags,
|
||||
0, // replyTo
|
||||
topicRootId,
|
||||
cursor,
|
||||
Data::PreviewState::Allowed));
|
||||
history->clearLocalEditDraft(topicRootId);
|
||||
thread->session().changes().entryUpdated(
|
||||
thread,
|
||||
Data::EntryUpdate::Flag::LocalDraftSet);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MainWidget::sendPaths(
|
||||
not_null<Data::Thread*> thread,
|
||||
const QStringList &paths) {
|
||||
|
Reference in New Issue
Block a user