Fix first message date with new peer info.

This commit is contained in:
John Preston 2025-05-07 18:53:21 +04:00
parent cae192682b
commit a3637c12d6
3 changed files with 4 additions and 3 deletions

View file

@ -323,7 +323,7 @@ public:
return (_flags & MessageFlag::HideEdited); return (_flags & MessageFlag::HideEdited);
} }
[[nodiscard]] bool hideDisplayDate() const { [[nodiscard]] bool hideDisplayDate() const {
return (_flags & MessageFlag::HideDisplayDate); return isEmpty() || (_flags & MessageFlag::HideDisplayDate);
} }
[[nodiscard]] bool isLocal() const { [[nodiscard]] bool isLocal() const {
return _flags & MessageFlag::Local; return _flags & MessageFlag::Local;

View file

@ -1397,7 +1397,7 @@ void Element::recountDisplayDateInBlocks() {
if (const auto previous = previousDisplayedInBlocks()) { if (const auto previous = previousDisplayedInBlocks()) {
const auto prev = previous->data(); const auto prev = previous->data();
return prev->isEmpty() return prev->hideDisplayDate()
|| (previous->dateTime().date() != dateTime().date()); || (previous->dateTime().date() != dateTime().date());
} }
return true; return true;

View file

@ -4077,7 +4077,8 @@ void ListWidget::refreshAttachmentsFromTill(int from, int till) {
const auto viewDate = view->dateTime(); const auto viewDate = view->dateTime();
const auto nextDate = next->dateTime(); const auto nextDate = next->dateTime();
next->setDisplayDate(_context != Context::ShortcutMessages next->setDisplayDate(_context != Context::ShortcutMessages
&& nextDate.date() != viewDate.date()); && (nextDate.date() != viewDate.date()
|| view->data()->hideDisplayDate()));
auto attached = next->computeIsAttachToPrevious(view); auto attached = next->computeIsAttachToPrevious(view);
next->setAttachToPrevious(attached, view); next->setAttachToPrevious(attached, view);
view->setAttachToNext(attached, next); view->setAttachToNext(attached, next);