fix: check time before appending

This commit is contained in:
AlexeyZavar 2024-04-19 02:46:28 +03:00
parent 11abaac7c1
commit 39e3fcb553

View file

@ -1163,14 +1163,16 @@ void HistoryItem::setServiceText(PreparedServiceText &&prepared) {
auto text = std::move(prepared.text);
const auto settings = &AyuSettings::getInstance();
const auto timeString = QString(" (%1)").arg(QLocale().toString(
base::unixtime::parse(_date),
settings->showMessageSeconds
? QLocale::system().timeFormat(QLocale::LongFormat).remove(" t")
: QLocale::system().timeFormat(QLocale::ShortFormat)
));
if (!text.text.isEmpty() && !text.text.contains(timeString)) {
text = text.append(timeString);
if (date() > 0) {
const auto timeString = QString(" (%1)").arg(QLocale().toString(
base::unixtime::parse(_date),
settings->showMessageSeconds
? QLocale::system().timeFormat(QLocale::LongFormat).remove(" t")
: QLocale::system().timeFormat(QLocale::ShortFormat)
));
if (!text.text.isEmpty() && !text.text.contains(timeString)) {
text = text.append(timeString);
}
}
AddComponents(HistoryServiceData::Bit());