From 1a279c44094814d0645b11f411286d65da40068e Mon Sep 17 00:00:00 2001 From: ZavaruKitsu Date: Sun, 24 Dec 2023 22:26:10 +0300 Subject: [PATCH] feat: show service message time --- Telegram/SourceFiles/history/history_item.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 2bdcb3cfb..4f8672f3f 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -1130,11 +1130,21 @@ void HistoryItem::setCommentsItemId(FullMsgId id) { } void HistoryItem::setServiceText(PreparedServiceText &&prepared) { + auto text = std::move(prepared.text); + if (!prepared.text.empty()) { + const auto settings = &AyuSettings::getInstance(); + text = text.append(QString(" (%1)").arg(QLocale().toString( + base::unixtime::parse(_date), + settings->showMessageSeconds ? QLocale::system().timeFormat(QLocale::LongFormat).remove(" t") + : QLocale::system().timeFormat(QLocale::ShortFormat) + ))); + } + AddComponents(HistoryServiceData::Bit()); _flags &= ~MessageFlag::HasTextLinks; const auto data = Get(); const auto had = !_text.empty(); - _text = std::move(prepared.text); + _text = std::move(text); data->textLinks = std::move(prepared.links); if (had) { _history->owner().requestItemTextRefresh(this);