mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-29 15:01:03 +00:00
Empty messages do not participate in displayDate() flow.
Example of an empty message is service message after clear history.
This commit is contained in:
parent
23a598ba3d
commit
a5cbbba12d
@ -107,7 +107,7 @@ void paintRow(Painter &p, History *history, HistoryItem *item, HistoryDraft *dra
|
||||
} else {
|
||||
history->typingText.drawElided(p, nameleft, texttop, namewidth);
|
||||
}
|
||||
} else {
|
||||
} else if (!item->isEmpty()) {
|
||||
paintRowDate(p, item->date, rectForName, active);
|
||||
|
||||
// draw check
|
||||
|
@ -2838,6 +2838,15 @@ void HistoryItem::clipCallback(ClipReaderNotification notification) {
|
||||
}
|
||||
}
|
||||
|
||||
bool HistoryItem::displayDate() const {
|
||||
if (isEmpty()) return false;
|
||||
|
||||
if (auto prev = previous()) {
|
||||
return prev->isEmpty() || (prev->date.date() != date.date());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
HistoryItem::~HistoryItem() {
|
||||
App::historyUnregItem(this);
|
||||
if (id < 0 && App::uploader()) {
|
||||
|
@ -1488,12 +1488,7 @@ protected:
|
||||
// this should be used only in previousItemChanged()
|
||||
// to add required bits to the Composer mask
|
||||
// after that always use Has<HistoryMessageDate>()
|
||||
bool displayDate() const {
|
||||
if (auto prev = previous()) {
|
||||
return prev->date.date() != date.date();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool displayDate() const;
|
||||
|
||||
// this should be used only in previousItemChanged() or when
|
||||
// HistoryMessageDate or HistoryMessageUnreadBar bit is changed in the Composer mask
|
||||
|
@ -821,7 +821,6 @@ void MainWidget::clearHistory(PeerData *peer) {
|
||||
h->clear();
|
||||
h->newLoaded = h->oldLoaded = true;
|
||||
}
|
||||
Ui::showPeerHistory(peer->id, ShowAtUnreadMsgId);
|
||||
MTPmessages_DeleteHistory::Flags flags = MTPmessages_DeleteHistory::Flag::f_just_clear;
|
||||
DeleteHistoryRequest request = { peer, true };
|
||||
MTP::send(MTPmessages_DeleteHistory(MTP_flags(flags), peer->input, MTP_int(0)), rpcDone(&MainWidget::deleteHistoryPart, request));
|
||||
|
@ -280,6 +280,7 @@ void ActionsWidget::onClearHistory() {
|
||||
void ActionsWidget::onClearHistorySure() {
|
||||
Ui::hideLayer();
|
||||
App::main()->clearHistory(peer());
|
||||
Ui::showPeerHistory(peer(), ShowAtUnreadMsgId);
|
||||
}
|
||||
|
||||
void ActionsWidget::onDeleteConversation() {
|
||||
|
Loading…
Reference in New Issue
Block a user