feat: show service message time

This commit is contained in:
ZavaruKitsu 2023-12-24 22:26:10 +03:00
parent f1adebb23e
commit 1a279c4409

View file

@ -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<HistoryServiceData>();
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);