mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Always show manual quote replies, hide redundant.
This commit is contained in:
parent
5350c97f82
commit
d7539349c7
6 changed files with 33 additions and 17 deletions
|
@ -260,7 +260,11 @@ public:
|
||||||
return _widget ? _widget->elementAnimationsPaused() : false;
|
return _widget ? _widget->elementAnimationsPaused() : false;
|
||||||
}
|
}
|
||||||
bool elementHideReply(not_null<const Element*> view) override {
|
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 {
|
bool elementShownUnread(not_null<const Element*> view) override {
|
||||||
return view->data()->unread(view->data()->history());
|
return view->data()->unread(view->data()->history());
|
||||||
|
|
|
@ -498,7 +498,8 @@ Element::Element(
|
||||||
| Flag::NeedsResize
|
| Flag::NeedsResize
|
||||||
| (IsItemScheduledUntilOnline(data)
|
| (IsItemScheduledUntilOnline(data)
|
||||||
? Flag::ScheduledUntilOnline
|
? Flag::ScheduledUntilOnline
|
||||||
: Flag()))
|
: Flag())
|
||||||
|
| (countIsTopicRootReply() ? Flag::TopicRootReply : Flag()))
|
||||||
, _context(delegate->elementContext()) {
|
, _context(delegate->elementContext()) {
|
||||||
history()->owner().registerItemView(this);
|
history()->owner().registerItemView(this);
|
||||||
refreshMedia(replacing);
|
refreshMedia(replacing);
|
||||||
|
@ -1260,15 +1261,6 @@ QSize Element::countCurrentSize(int newWidth) {
|
||||||
return performCountCurrentSize(newWidth);
|
return performCountCurrentSize(newWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Element::refreshIsTopicRootReply() {
|
|
||||||
const auto topicRootReply = countIsTopicRootReply();
|
|
||||||
if (topicRootReply) {
|
|
||||||
_flags |= Flag::TopicRootReply;
|
|
||||||
} else {
|
|
||||||
_flags &= ~Flag::TopicRootReply;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Element::countIsTopicRootReply() const {
|
bool Element::countIsTopicRootReply() const {
|
||||||
const auto item = data();
|
const auto item = data();
|
||||||
if (!item->history()->isForum()) {
|
if (!item->history()->isForum()) {
|
||||||
|
|
|
@ -565,7 +565,6 @@ protected:
|
||||||
|
|
||||||
void clearSpecialOnlyEmoji();
|
void clearSpecialOnlyEmoji();
|
||||||
void checkSpecialOnlyEmoji();
|
void checkSpecialOnlyEmoji();
|
||||||
void refreshIsTopicRootReply();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// This should be called only from previousInBlocksChanged()
|
// This should be called only from previousInBlocksChanged()
|
||||||
|
|
|
@ -601,7 +601,7 @@ QSize Message::performCountOptimalSize() {
|
||||||
const auto item = data();
|
const auto item = data();
|
||||||
|
|
||||||
const auto replyData = item->Get<HistoryMessageReply>();
|
const auto replyData = item->Get<HistoryMessageReply>();
|
||||||
if (replyData) {
|
if (replyData && !_hideReply) {
|
||||||
AddComponents(Reply::Bit());
|
AddComponents(Reply::Bit());
|
||||||
} else {
|
} else {
|
||||||
RemoveComponents(Reply::Bit());
|
RemoveComponents(Reply::Bit());
|
||||||
|
@ -616,7 +616,6 @@ QSize Message::performCountOptimalSize() {
|
||||||
: 2;
|
: 2;
|
||||||
};
|
};
|
||||||
const auto oldKey = reactionsKey();
|
const auto oldKey = reactionsKey();
|
||||||
refreshIsTopicRootReply();
|
|
||||||
validateText();
|
validateText();
|
||||||
validateInlineKeyboard(markup);
|
validateInlineKeyboard(markup);
|
||||||
updateViewButtonExistence();
|
updateViewButtonExistence();
|
||||||
|
|
|
@ -597,7 +597,11 @@ void PinnedWidget::listUpdateDateLink(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PinnedWidget::listElementHideReply(not_null<const Element*> view) {
|
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) {
|
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 id = FullMsgId(_history->peer->id, messageId);
|
||||||
const auto message = _history->owner().message(id);
|
const auto message = _history->owner().message(id);
|
||||||
if (!message || !message->inThread(_rootId)) {
|
if (!message || (!message->inThread(_rootId) && id.msg != _rootId)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const auto originMessage = [&]() -> HistoryItem* {
|
const auto originMessage = [&]() -> HistoryItem* {
|
||||||
|
@ -2516,7 +2516,25 @@ void RepliesWidget::listUpdateDateLink(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RepliesWidget::listElementHideReply(not_null<const Element*> view) {
|
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) {
|
bool RepliesWidget::listElementShownUnread(not_null<const Element*> view) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue