From dee8b1fe6fc6381bf82bc4e84067dd04b2b5126a Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 9 Nov 2021 21:41:13 +0400 Subject: [PATCH] Don't attach outgoing items from a channel to each other. --- .../SourceFiles/history/view/history_view_element.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/history/view/history_view_element.cpp b/Telegram/SourceFiles/history/view/history_view_element.cpp index 7cfa00632..2e2c2412a 100644 --- a/Telegram/SourceFiles/history/view/history_view_element.cpp +++ b/Telegram/SourceFiles/history/view/history_view_element.cpp @@ -535,11 +535,13 @@ void Element::refreshDataId() { } bool Element::computeIsAttachToPrevious(not_null previous) { - const auto mayBeAttached = [](not_null item) { + const auto mayBeAttached = [](not_null view) { + const auto item = view->data(); return !item->isService() && !item->isEmpty() && !item->isPost() - && (item->from() != item->history()->peer + && (!item->history()->peer->isMegagroup() + || !view->hasOutLayout() || !item->from()->isChannel()); }; const auto item = data(); @@ -547,8 +549,8 @@ bool Element::computeIsAttachToPrevious(not_null previous) { const auto prev = previous->data(); const auto possible = (std::abs(prev->date() - item->date()) < kAttachMessageToPreviousSecondsDelta) - && mayBeAttached(item) - && mayBeAttached(prev); + && mayBeAttached(this) + && mayBeAttached(previous); if (possible) { const auto forwarded = item->Get(); const auto prevForwarded = prev->Get();