From 0fe738ee3a8f9e730e123f2658270afdc707eacf Mon Sep 17 00:00:00 2001 From: RadRussianRus Date: Thu, 24 Dec 2020 17:05:17 +0300 Subject: [PATCH] Post-merge fixes --- Telegram/SourceFiles/apiwrap.cpp | 2 +- Telegram/SourceFiles/data/data_folder.cpp | 1 + Telegram/SourceFiles/dialogs/dialogs_layout.cpp | 6 ++++-- Telegram/SourceFiles/history/history_widget.cpp | 6 +++--- .../view/controls/history_view_compose_controls.cpp | 9 ++++++--- .../SourceFiles/info/profile/info_profile_actions.cpp | 6 ++++-- Telegram/SourceFiles/window/window_peer_menu.cpp | 2 +- 7 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 6a8870b11..728254665 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -4109,7 +4109,7 @@ void ApiWrap::forwardMessages( const auto media = item->media(); auto inputMedia = media->photo() ? MTP_inputMediaPhoto(MTP_flags(0), media->photo()->mtpInput(), MTPint()) - : MTP_inputMediaDocument(MTP_flags(0), media->document()->mtpInput(), MTPint()); + : MTP_inputMediaDocument(MTP_flags(0), media->document()->mtpInput(), MTPint(), MTPstring()); auto caption = cForwardCaptioned() ? item->originalText() : TextWithEntities(); diff --git a/Telegram/SourceFiles/data/data_folder.cpp b/Telegram/SourceFiles/data/data_folder.cpp index 797a7b99f..2677144ec 100644 --- a/Telegram/SourceFiles/data/data_folder.cpp +++ b/Telegram/SourceFiles/data/data_folder.cpp @@ -24,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "apiwrap.h" #include "mainwidget.h" #include "styles/style_dialogs.h" +#include "styles/style_widgets.h" namespace Data { namespace { diff --git a/Telegram/SourceFiles/dialogs/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/dialogs_layout.cpp index 4d8e2dd54..6b6f5eb12 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_layout.cpp @@ -263,6 +263,8 @@ void paintOneLineRow( p.fillRect(fullRect, bg); row->paintRipple(p, 0, 0, fullWidth, &ripple->c); + const auto history = chat.history(); + if (flags & Flag::SavedMessages) { Ui::EmptyUserpic::PaintSavedMessages( p, @@ -274,7 +276,8 @@ void paintOneLineRow( row->paintUserpic( p, from, - (flags & Flag::AllowUserOnline), + (flags & Flag::AllowUserOnline) ? history : nullptr, + ms, active, fullWidth); } else if (hiddenSenderInfo) { @@ -302,7 +305,6 @@ void paintOneLineRow( return; } - const auto history = chat.history(); auto namewidth = fullWidth - nameleft - st::dialogsPadding.x(); auto rectForName = QRect( nameleft, diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 66af9a136..ab4aa05ff 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -404,7 +404,7 @@ HistoryWidget::HistoryWidget( _fieldAutocomplete->mentionChosen( ) | rpl::start_with_next([=](FieldAutocomplete::MentionChosen data) { - onMentionInsert(data.user, data.method); + insertMention(data.user, data.method); }, lifetime()); _fieldAutocomplete->hashtagChosen( @@ -1341,7 +1341,7 @@ void HistoryWidget::start() { }); } -void HistoryWidget::onMentionInsert(UserData *user, FieldAutocomplete::ChooseMethod method) { +void HistoryWidget::insertMention(UserData *user, FieldAutocomplete::ChooseMethod method) { QString replacement, entityTag; if (user->username.isEmpty() || method == FieldAutocomplete::ChooseMethod::ByRightClick @@ -1730,7 +1730,7 @@ void HistoryWidget::setupShortcuts() { }); } request->check(Command::SaveDraft, 1) && request->handle([=] { - onCloudDraftSave(); + saveCloudDraft(); return true; }); request->check(Command::JumpToDate, 1) && request->handle([=] { diff --git a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp index 2e5511f04..606248a07 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_compose_controls.cpp @@ -1098,10 +1098,13 @@ void ComposeControls::initAutocomplete() { _field->insertTag(string); } }; - const auto insertMention = [=](not_null user) { + const auto insertMention = [=](not_null user, FieldAutocomplete::ChooseMethod method) { auto replacement = QString(); auto entityTag = QString(); - if (user->username.isEmpty()) { + if (user->username.isEmpty() + || method == FieldAutocomplete::ChooseMethod::ByRightClick + || method == FieldAutocomplete::ChooseMethod::ByCtrlEnter + || method == FieldAutocomplete::ChooseMethod::ByCtrlClick) { _field->insertTag( user->firstName.isEmpty() ? user->name : user->firstName, PrepareMentionTag(user)); @@ -1112,7 +1115,7 @@ void ComposeControls::initAutocomplete() { _autocomplete->mentionChosen( ) | rpl::start_with_next([=](FieldAutocomplete::MentionChosen data) { - insertMention(data.user); + insertMention(data.user, data.method); }, _autocomplete->lifetime()); _autocomplete->hashtagChosen( diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index bbf02a21e..62c153e08 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -1023,8 +1023,10 @@ void ManageFiller::addChannelRecentActions( _wrap, tr::lng_manage_peer_recent_actions(), rpl::single(true), - [=] { controller->showSection(AdminLog::SectionMemento(channel)); } - ); + [=] { + controller->showSection( + std::make_shared(channel)); + }); object_ptr( button, st::infoIconRecentActions, diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 0e3174b43..37ee11a4f 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -1311,7 +1311,7 @@ QPointer ShowForwardMessagesBox( const auto media = item->media(); const auto inputMedia = media->photo() ? MTP_inputMediaPhoto(MTP_flags(0), media->photo()->mtpInput(), MTPint()) - : MTP_inputMediaDocument(MTP_flags(0), media->document()->mtpInput(), MTPint()); + : MTP_inputMediaDocument(MTP_flags(0), media->document()->mtpInput(), MTPint(), MTPstring()); const auto caption = cForwardCaptioned() ? item->originalText() : TextWithEntities();