fix: message shot replies in topics

This commit is contained in:
AlexeyZavar 2024-02-22 22:59:22 +03:00
parent 039795cab8
commit bf5337259d
2 changed files with 18 additions and 10 deletions

View file

@ -215,7 +215,7 @@ AyuGramSettings::AyuGramSettings() {
simpleQuotesAndReplies = true; simpleQuotesAndReplies = true;
deletedMark = "🧹"; deletedMark = "🧹";
editedMark = Core::IsAppLaunched() ? tr::lng_edited(tr::now) : QString("edited"); editedMark = Core::IsAppLaunched() ? tr::lng_edited(tr::now) : QString("edited");
recentStickersCount = 50; recentStickersCount = 100;
// context menu items // context menu items
// 0 - hide // 0 - hide
@ -227,7 +227,7 @@ AyuGramSettings::AyuGramSettings() {
showUserMessagesInContextMenu = 2; showUserMessagesInContextMenu = 2;
showMessageDetailsInContextMenu = 2; showMessageDetailsInContextMenu = 2;
showLReadToggleInDrawer = true; showLReadToggleInDrawer = false;
showSReadToggleInDrawer = true; showSReadToggleInDrawer = true;
showGhostToggleInDrawer = true; showGhostToggleInDrawer = true;
showStreamerToggleInDrawer = false; showStreamerToggleInDrawer = false;

View file

@ -15,6 +15,7 @@
#include "data/data_cloud_themes.h" #include "data/data_cloud_themes.h"
#include "data/data_peer.h" #include "data/data_peer.h"
#include "data/data_session.h" #include "data/data_session.h"
#include "history/history.h"
#include "history/history_inner_widget.h" #include "history/history_inner_widget.h"
#include "history/history_item.h" #include "history/history_item.h"
#include "history/view/history_view_element.h" #include "history/view/history_view_element.h"
@ -150,7 +151,8 @@ public:
MessageShotDelegate( MessageShotDelegate(
not_null<QWidget*> parent, not_null<QWidget*> parent,
not_null<Ui::ChatStyle*> st, not_null<Ui::ChatStyle*> st,
Fn<void()> update); Fn<void()> update,
bool isTopic);
bool elementAnimationsPaused() override; bool elementAnimationsPaused() override;
not_null<Ui::PathShiftGradient*> elementPathShiftGradient() override; not_null<Ui::PathShiftGradient*> elementPathShiftGradient() override;
@ -160,14 +162,17 @@ public:
private: private:
const not_null<QWidget*> _parent; const not_null<QWidget*> _parent;
const std::unique_ptr<Ui::PathShiftGradient> _pathGradient; const std::unique_ptr<Ui::PathShiftGradient> _pathGradient;
HistoryView::Context _context;
}; };
MessageShotDelegate::MessageShotDelegate( MessageShotDelegate::MessageShotDelegate(
not_null<QWidget*> parent, not_null<QWidget*> parent,
not_null<Ui::ChatStyle*> st, not_null<Ui::ChatStyle*> st,
Fn<void()> update) Fn<void()> update,
bool isTopic)
: _parent(parent) : _parent(parent)
, _pathGradient(HistoryView::MakePathShiftGradient(st, update)) { , _pathGradient(HistoryView::MakePathShiftGradient(st, update)) {
_context = isTopic ? HistoryView::Context::Replies : HistoryView::Context::AdminLog;
} }
bool MessageShotDelegate::elementAnimationsPaused() { bool MessageShotDelegate::elementAnimationsPaused() {
@ -255,12 +260,14 @@ QImage Make(not_null<QWidget*> box, const ShotConfig &config) {
takingShot = true; takingShot = true;
auto delegate = std::make_unique<MessageShotDelegate>(box, auto delegate = std::make_unique<MessageShotDelegate>(
box,
st.get(), st.get(),
[=] [=]
{ {
box->update(); box->update();
}); },
messages.front()->history()->asTopic());
// remove deleted messages // remove deleted messages
messages.erase( messages.erase(
@ -413,4 +420,5 @@ void Wrapper(not_null<HistoryView::ListWidget*> widget) {
auto box = Box<MessageShotBox>(config); auto box = Box<MessageShotBox>(config);
Ui::show(std::move(box)); Ui::show(std::move(box));
} }
} }