mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-25 01:50:36 +00:00
Always show manual quote replies, hide redundant.
This commit is contained in:
parent
5350c97f82
commit
d7539349c7
@ -260,7 +260,11 @@ public:
|
||||
return _widget ? _widget->elementAnimationsPaused() : false;
|
||||
}
|
||||
bool elementHideReply(not_null<const Element*> view) override {
|
||||
return view->isTopicRootReply();
|
||||
if (!view->isTopicRootReply()) {
|
||||
return false;
|
||||
}
|
||||
const auto reply = view->data()->Get<HistoryMessageReply>();
|
||||
return reply && !reply->fields().manualQuote;
|
||||
}
|
||||
bool elementShownUnread(not_null<const Element*> view) override {
|
||||
return view->data()->unread(view->data()->history());
|
||||
|
@ -498,7 +498,8 @@ Element::Element(
|
||||
| Flag::NeedsResize
|
||||
| (IsItemScheduledUntilOnline(data)
|
||||
? Flag::ScheduledUntilOnline
|
||||
: Flag()))
|
||||
: Flag())
|
||||
| (countIsTopicRootReply() ? Flag::TopicRootReply : Flag()))
|
||||
, _context(delegate->elementContext()) {
|
||||
history()->owner().registerItemView(this);
|
||||
refreshMedia(replacing);
|
||||
@ -1260,15 +1261,6 @@ QSize Element::countCurrentSize(int newWidth) {
|
||||
return performCountCurrentSize(newWidth);
|
||||
}
|
||||
|
||||
void Element::refreshIsTopicRootReply() {
|
||||
const auto topicRootReply = countIsTopicRootReply();
|
||||
if (topicRootReply) {
|
||||
_flags |= Flag::TopicRootReply;
|
||||
} else {
|
||||
_flags &= ~Flag::TopicRootReply;
|
||||
}
|
||||
}
|
||||
|
||||
bool Element::countIsTopicRootReply() const {
|
||||
const auto item = data();
|
||||
if (!item->history()->isForum()) {
|
||||
|
@ -565,7 +565,6 @@ protected:
|
||||
|
||||
void clearSpecialOnlyEmoji();
|
||||
void checkSpecialOnlyEmoji();
|
||||
void refreshIsTopicRootReply();
|
||||
|
||||
private:
|
||||
// This should be called only from previousInBlocksChanged()
|
||||
|
@ -601,7 +601,7 @@ QSize Message::performCountOptimalSize() {
|
||||
const auto item = data();
|
||||
|
||||
const auto replyData = item->Get<HistoryMessageReply>();
|
||||
if (replyData) {
|
||||
if (replyData && !_hideReply) {
|
||||
AddComponents(Reply::Bit());
|
||||
} else {
|
||||
RemoveComponents(Reply::Bit());
|
||||
@ -616,7 +616,6 @@ QSize Message::performCountOptimalSize() {
|
||||
: 2;
|
||||
};
|
||||
const auto oldKey = reactionsKey();
|
||||
refreshIsTopicRootReply();
|
||||
validateText();
|
||||
validateInlineKeyboard(markup);
|
||||
updateViewButtonExistence();
|
||||
|
@ -597,7 +597,11 @@ void PinnedWidget::listUpdateDateLink(
|
||||
}
|
||||
|
||||
bool PinnedWidget::listElementHideReply(not_null<const Element*> view) {
|
||||
return (view->data()->replyToId() == _thread->topicRootId());
|
||||
if (const auto reply = view->data()->Get<HistoryMessageReply>()) {
|
||||
return !reply->fields().manualQuote
|
||||
&& (reply->messageId() == _thread->topicRootId());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PinnedWidget::listElementShownUnread(not_null<const Element*> view) {
|
||||
|
@ -2020,7 +2020,7 @@ bool RepliesWidget::showMessage(
|
||||
}
|
||||
const auto id = FullMsgId(_history->peer->id, messageId);
|
||||
const auto message = _history->owner().message(id);
|
||||
if (!message || !message->inThread(_rootId)) {
|
||||
if (!message || (!message->inThread(_rootId) && id.msg != _rootId)) {
|
||||
return false;
|
||||
}
|
||||
const auto originMessage = [&]() -> HistoryItem* {
|
||||
@ -2516,7 +2516,25 @@ void RepliesWidget::listUpdateDateLink(
|
||||
}
|
||||
|
||||
bool RepliesWidget::listElementHideReply(not_null<const Element*> view) {
|
||||
return (view->data()->replyToId() == _rootId);
|
||||
if (const auto reply = view->data()->Get<HistoryMessageReply>()) {
|
||||
const auto replyToPeerId = reply->externalPeerId()
|
||||
? reply->externalPeerId()
|
||||
: _history->peer->id;
|
||||
if (reply->fields().manualQuote) {
|
||||
return false;
|
||||
} else if (replyToPeerId == _history->peer->id) {
|
||||
return (reply->messageId() == _rootId);
|
||||
} else if (_root) {
|
||||
const auto forwarded = _root->Get<HistoryMessageForwarded>();
|
||||
if (forwarded
|
||||
&& forwarded->savedFromPeer
|
||||
&& forwarded->savedFromPeer->id == replyToPeerId
|
||||
&& forwarded->savedFromMsgId == reply->messageId()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RepliesWidget::listElementShownUnread(not_null<const Element*> view) {
|
||||
|
Loading…
Reference in New Issue
Block a user