mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix external quote-reply to topic message.
This commit is contained in:
parent
d1c310de00
commit
475b2ac739
6 changed files with 27 additions and 10 deletions
|
@ -2090,6 +2090,7 @@ void ListWidget::paintEvent(QPaintEvent *e) {
|
||||||
});
|
});
|
||||||
|
|
||||||
auto context = preparePaintContext(clip);
|
auto context = preparePaintContext(clip);
|
||||||
|
context.highlightPathCache = &_highlightPathCache;
|
||||||
if (from == end(_items)) {
|
if (from == end(_items)) {
|
||||||
_delegate->listPaintEmpty(p, context);
|
_delegate->listPaintEmpty(p, context);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -649,6 +649,7 @@ private:
|
||||||
base::flat_map<MsgId, Ui::PeerUserpicView> _hiddenSenderUserpics;
|
base::flat_map<MsgId, Ui::PeerUserpicView> _hiddenSenderUserpics;
|
||||||
|
|
||||||
const std::unique_ptr<Ui::PathShiftGradient> _pathGradient;
|
const std::unique_ptr<Ui::PathShiftGradient> _pathGradient;
|
||||||
|
QPainterPath _highlightPathCache;
|
||||||
|
|
||||||
base::unique_qptr<Ui::RpWidget> _emptyInfo = nullptr;
|
base::unique_qptr<Ui::RpWidget> _emptyInfo = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -1123,6 +1123,8 @@ void Message::draw(Painter &p, const PaintContext &context) const {
|
||||||
const auto mediaSelection = _invertMedia
|
const auto mediaSelection = _invertMedia
|
||||||
? context.selection
|
? context.selection
|
||||||
: skipTextSelection(context.selection);
|
: skipTextSelection(context.selection);
|
||||||
|
const auto maybeMediaHighlight = context.highlightPathCache
|
||||||
|
&& context.highlightPathCache->isEmpty();
|
||||||
auto mediaPosition = QPoint(inner.left(), top);
|
auto mediaPosition = QPoint(inner.left(), top);
|
||||||
p.translate(mediaPosition);
|
p.translate(mediaPosition);
|
||||||
media->draw(p, context.translated(
|
media->draw(p, context.translated(
|
||||||
|
@ -1135,7 +1137,7 @@ void Message::draw(Painter &p, const PaintContext &context) const {
|
||||||
context.reactionInfo->effectOffset -= add;
|
context.reactionInfo->effectOffset -= add;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (context.highlightPathCache
|
if (maybeMediaHighlight
|
||||||
&& !context.highlightPathCache->isEmpty()) {
|
&& !context.highlightPathCache->isEmpty()) {
|
||||||
context.highlightPathCache->translate(mediaPosition);
|
context.highlightPathCache->translate(mediaPosition);
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,10 +128,12 @@ rpl::producer<Ui::MessageBarContent> RootViewContent(
|
||||||
RepliesMemento::RepliesMemento(
|
RepliesMemento::RepliesMemento(
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
MsgId rootId,
|
MsgId rootId,
|
||||||
MsgId highlightId)
|
MsgId highlightId,
|
||||||
|
const TextWithEntities &highlightPart)
|
||||||
: _history(history)
|
: _history(history)
|
||||||
, _rootId(rootId)
|
, _rootId(rootId)
|
||||||
, _highlightId(highlightId) {
|
, _highlightId(highlightId)
|
||||||
|
, _highlightPart(highlightPart) {
|
||||||
if (highlightId) {
|
if (highlightId) {
|
||||||
_list.setAroundPosition({
|
_list.setAroundPosition({
|
||||||
.fullId = FullMsgId(_history->peer->id, highlightId),
|
.fullId = FullMsgId(_history->peer->id, highlightId),
|
||||||
|
@ -1966,7 +1968,7 @@ bool RepliesWidget::showInternal(
|
||||||
if (logMemento->getHistory() == history()
|
if (logMemento->getHistory() == history()
|
||||||
&& logMemento->getRootId() == _rootId) {
|
&& logMemento->getRootId() == _rootId) {
|
||||||
restoreState(logMemento);
|
restoreState(logMemento);
|
||||||
if (!logMemento->getHighlightId()) {
|
if (!logMemento->highlightId()) {
|
||||||
showAtPosition(Data::UnreadMessagePosition);
|
showAtPosition(Data::UnreadMessagePosition);
|
||||||
}
|
}
|
||||||
if (params.reapplyLocalDraft) {
|
if (params.reapplyLocalDraft) {
|
||||||
|
@ -2033,7 +2035,8 @@ bool RepliesWidget::showMessage(
|
||||||
if (!originMessage) {
|
if (!originMessage) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const auto originItemId = (_cornerButtons.replyReturn() != originMessage)
|
const auto currentReplyReturn = _cornerButtons.replyReturn();
|
||||||
|
const auto originItemId = (currentReplyReturn != originMessage)
|
||||||
? originMessage->fullId()
|
? originMessage->fullId()
|
||||||
: FullMsgId();
|
: FullMsgId();
|
||||||
showAtPosition(message->position(), originItemId, params);
|
showAtPosition(message->position(), originItemId, params);
|
||||||
|
@ -2138,11 +2141,15 @@ void RepliesWidget::restoreState(not_null<RepliesMemento*> memento) {
|
||||||
}
|
}
|
||||||
_cornerButtons.setReplyReturns(memento->replyReturns());
|
_cornerButtons.setReplyReturns(memento->replyReturns());
|
||||||
_inner->restoreState(memento->list());
|
_inner->restoreState(memento->list());
|
||||||
if (const auto highlight = memento->getHighlightId()) {
|
if (const auto highlight = memento->highlightId()) {
|
||||||
|
auto params = Window::SectionShow(
|
||||||
|
Window::SectionShow::Way::Forward,
|
||||||
|
anim::type::instant);
|
||||||
|
params.highlightPart = memento->highlightPart();
|
||||||
showAtPosition(Data::MessagePosition{
|
showAtPosition(Data::MessagePosition{
|
||||||
.fullId = FullMsgId(_history->peer->id, highlight),
|
.fullId = FullMsgId(_history->peer->id, highlight),
|
||||||
.date = TimeId(0),
|
.date = TimeId(0),
|
||||||
}, {}, { Window::SectionShow::Way::Forward, anim::type::instant });
|
}, {}, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -380,7 +380,8 @@ public:
|
||||||
RepliesMemento(
|
RepliesMemento(
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
MsgId rootId,
|
MsgId rootId,
|
||||||
MsgId highlightId = 0);
|
MsgId highlightId = 0,
|
||||||
|
const TextWithEntities &highlightPart = {});
|
||||||
explicit RepliesMemento(
|
explicit RepliesMemento(
|
||||||
not_null<HistoryItem*> commentsItem,
|
not_null<HistoryItem*> commentsItem,
|
||||||
MsgId commentId = 0);
|
MsgId commentId = 0);
|
||||||
|
@ -424,9 +425,12 @@ public:
|
||||||
[[nodiscard]] not_null<ListMemento*> list() {
|
[[nodiscard]] not_null<ListMemento*> list() {
|
||||||
return &_list;
|
return &_list;
|
||||||
}
|
}
|
||||||
[[nodiscard]] MsgId getHighlightId() const {
|
[[nodiscard]] MsgId highlightId() const {
|
||||||
return _highlightId;
|
return _highlightId;
|
||||||
}
|
}
|
||||||
|
[[nodiscard]] const TextWithEntities &highlightPart() const {
|
||||||
|
return _highlightPart;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupTopicViewer();
|
void setupTopicViewer();
|
||||||
|
@ -434,6 +438,7 @@ private:
|
||||||
const not_null<History*> _history;
|
const not_null<History*> _history;
|
||||||
MsgId _rootId = 0;
|
MsgId _rootId = 0;
|
||||||
const MsgId _highlightId = 0;
|
const MsgId _highlightId = 0;
|
||||||
|
const TextWithEntities _highlightPart;
|
||||||
ListMemento _list;
|
ListMemento _list;
|
||||||
std::shared_ptr<Data::RepliesList> _replies;
|
std::shared_ptr<Data::RepliesList> _replies;
|
||||||
QVector<FullMsgId> _replyReturns;
|
QVector<FullMsgId> _replyReturns;
|
||||||
|
|
|
@ -850,7 +850,8 @@ void SessionNavigation::showRepliesForMessage(
|
||||||
auto memento = std::make_shared<HistoryView::RepliesMemento>(
|
auto memento = std::make_shared<HistoryView::RepliesMemento>(
|
||||||
history,
|
history,
|
||||||
rootId,
|
rootId,
|
||||||
commentId);
|
commentId,
|
||||||
|
params.highlightPart);
|
||||||
memento->setFromTopic(topic);
|
memento->setFromTopic(topic);
|
||||||
showSection(std::move(memento), params);
|
showSection(std::move(memento), params);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue