mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Don't attach outgoing items from a channel to each other.
This commit is contained in:
parent
3c040ab5f9
commit
dee8b1fe6f
1 changed files with 6 additions and 4 deletions
|
@ -535,11 +535,13 @@ void Element::refreshDataId() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Element::computeIsAttachToPrevious(not_null<Element*> previous) {
|
bool Element::computeIsAttachToPrevious(not_null<Element*> previous) {
|
||||||
const auto mayBeAttached = [](not_null<HistoryItem*> item) {
|
const auto mayBeAttached = [](not_null<Element*> view) {
|
||||||
|
const auto item = view->data();
|
||||||
return !item->isService()
|
return !item->isService()
|
||||||
&& !item->isEmpty()
|
&& !item->isEmpty()
|
||||||
&& !item->isPost()
|
&& !item->isPost()
|
||||||
&& (item->from() != item->history()->peer
|
&& (!item->history()->peer->isMegagroup()
|
||||||
|
|| !view->hasOutLayout()
|
||||||
|| !item->from()->isChannel());
|
|| !item->from()->isChannel());
|
||||||
};
|
};
|
||||||
const auto item = data();
|
const auto item = data();
|
||||||
|
@ -547,8 +549,8 @@ bool Element::computeIsAttachToPrevious(not_null<Element*> previous) {
|
||||||
const auto prev = previous->data();
|
const auto prev = previous->data();
|
||||||
const auto possible = (std::abs(prev->date() - item->date())
|
const auto possible = (std::abs(prev->date() - item->date())
|
||||||
< kAttachMessageToPreviousSecondsDelta)
|
< kAttachMessageToPreviousSecondsDelta)
|
||||||
&& mayBeAttached(item)
|
&& mayBeAttached(this)
|
||||||
&& mayBeAttached(prev);
|
&& mayBeAttached(previous);
|
||||||
if (possible) {
|
if (possible) {
|
||||||
const auto forwarded = item->Get<HistoryMessageForwarded>();
|
const auto forwarded = item->Get<HistoryMessageForwarded>();
|
||||||
const auto prevForwarded = prev->Get<HistoryMessageForwarded>();
|
const auto prevForwarded = prev->Get<HistoryMessageForwarded>();
|
||||||
|
|
Loading…
Add table
Reference in a new issue