Added handling of updates for rescheduled messages.

This commit is contained in:
23rd 2020-05-09 23:34:57 +03:00 committed by John Preston
parent 6559e83e83
commit 5a75dd2b6f
3 changed files with 15 additions and 0 deletions

View File

@ -414,6 +414,7 @@ HistoryItem *ScheduledMessages::append(
}, data.vmedia());
existing->updateReplyMarkup(data.vreply_markup());
existing->updateForwardedInfo(data.vfwd_from());
existing->updateDate(data.vdate().v);
history->owner().requestItemTextRefresh(existing);
}, [&](const auto &data) {});
return existing;

View File

@ -708,6 +708,17 @@ MsgId HistoryItem::idOriginal() const {
return id;
}
void HistoryItem::updateDate(TimeId newDate) {
if (canUpdateDate() && _date != newDate) {
_date = newDate;
_history->owner().requestItemViewRefresh(this);
}
}
bool HistoryItem::canUpdateDate() const {
return isScheduled();
}
void HistoryItem::sendFailed() {
Expects(_clientFlags & MTPDmessage_ClientFlag::f_sending);
Expects(!(_clientFlags & MTPDmessage_ClientFlag::f_failed));

View File

@ -328,6 +328,9 @@ public:
[[nodiscard]] virtual std::unique_ptr<HistoryView::Element> createView(
not_null<HistoryView::ElementDelegate*> delegate) = 0;
void updateDate(TimeId newDate);
[[nodiscard]] bool canUpdateDate() const;
virtual ~HistoryItem();
MsgId id;