Skip to content

Commit

Permalink
fix: message shot replies in topics
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyZavar committed Feb 22, 2024
1 parent 039795c commit bf53372
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Telegram/SourceFiles/ayu/ayu_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ AyuGramSettings::AyuGramSettings() {
simpleQuotesAndReplies = true;
deletedMark = "🧹";
editedMark = Core::IsAppLaunched() ? tr::lng_edited(tr::now) : QString("edited");
recentStickersCount = 50;
recentStickersCount = 100;

// context menu items
// 0 - hide
Expand All @@ -227,7 +227,7 @@ AyuGramSettings::AyuGramSettings() {
showUserMessagesInContextMenu = 2;
showMessageDetailsInContextMenu = 2;

showLReadToggleInDrawer = true;
showLReadToggleInDrawer = false;
showSReadToggleInDrawer = true;
showGhostToggleInDrawer = true;
showStreamerToggleInDrawer = false;
Expand Down
24 changes: 16 additions & 8 deletions Telegram/SourceFiles/ayu/features/messageshot/message_shot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "data/data_cloud_themes.h"
#include "data/data_peer.h"
#include "data/data_session.h"
#include "history/history.h"
#include "history/history_inner_widget.h"
#include "history/history_item.h"
#include "history/view/history_view_element.h"
Expand Down Expand Up @@ -150,7 +151,8 @@ class MessageShotDelegate final : public HistoryView::DefaultElementDelegate
MessageShotDelegate(
not_null<QWidget*> parent,
not_null<Ui::ChatStyle*> st,
Fn<void()> update);
Fn<void()> update,
bool isTopic);

bool elementAnimationsPaused() override;
not_null<Ui::PathShiftGradient*> elementPathShiftGradient() override;
Expand All @@ -160,14 +162,17 @@ class MessageShotDelegate final : public HistoryView::DefaultElementDelegate
private:
const not_null<QWidget*> _parent;
const std::unique_ptr<Ui::PathShiftGradient> _pathGradient;
HistoryView::Context _context;
};

MessageShotDelegate::MessageShotDelegate(
not_null<QWidget*> parent,
not_null<Ui::ChatStyle*> st,
Fn<void()> update)
Fn<void()> update,
bool isTopic)
: _parent(parent)
, _pathGradient(HistoryView::MakePathShiftGradient(st, update)) {
_context = isTopic ? HistoryView::Context::Replies : HistoryView::Context::AdminLog;
}

bool MessageShotDelegate::elementAnimationsPaused() {
Expand Down Expand Up @@ -255,12 +260,14 @@ QImage Make(not_null<QWidget*> box, const ShotConfig &config) {

takingShot = true;

auto delegate = std::make_unique<MessageShotDelegate>(box,
st.get(),
[=]
{
box->update();
});
auto delegate = std::make_unique<MessageShotDelegate>(
box,
st.get(),
[=]
{
box->update();
},
messages.front()->history()->asTopic());

// remove deleted messages
messages.erase(
Expand Down Expand Up @@ -413,4 +420,5 @@ void Wrapper(not_null<HistoryView::ListWidget*> widget) {
auto box = Box<MessageShotBox>(config);
Ui::show(std::move(box));
}

}

0 comments on commit bf53372

Please sign in to comment.