fix: various message improvements

This commit is contained in:
ZavaruKitsu 2024-01-02 01:54:39 +03:00
parent c102f4c0e5
commit 040794586b
2 changed files with 11 additions and 8 deletions

View file

@ -73,6 +73,7 @@ public:
// 2 - show with SHIFT or CTRL pressed // 2 - show with SHIFT or CTRL pressed
showReactionsPanelInContextMenu = 1; showReactionsPanelInContextMenu = 1;
showViewsPanelInContextMenu = 1; showViewsPanelInContextMenu = 1;
showHideMessageInContextMenu = 0;
showUserMessagesInContextMenu = 2; showUserMessagesInContextMenu = 2;
showMessageDetailsInContextMenu = 2; showMessageDetailsInContextMenu = 2;

View file

@ -1156,13 +1156,15 @@ void HistoryItem::setCommentsItemId(FullMsgId id) {
void HistoryItem::setServiceText(PreparedServiceText &&prepared) { void HistoryItem::setServiceText(PreparedServiceText &&prepared) {
auto text = std::move(prepared.text); auto text = std::move(prepared.text);
if (!text.text.isEmpty()) {
const auto settings = &AyuSettings::getInstance(); const auto settings = &AyuSettings::getInstance();
text = text.append(QString(" (%1)").arg(QLocale().toString( const auto timeString = QString(" (%1)").arg(QLocale().toString(
base::unixtime::parse(_date), base::unixtime::parse(_date),
settings->showMessageSeconds ? QLocale::system().timeFormat(QLocale::LongFormat).remove(" t") settings->showMessageSeconds ? QLocale::system().timeFormat(QLocale::LongFormat).remove(" t")
: QLocale::system().timeFormat(QLocale::ShortFormat) : QLocale::system().timeFormat(QLocale::ShortFormat)
))); ));
if (!text.text.isEmpty() && !text.text.contains(timeString)) {
text = text.append(timeString);
} }
AddComponents(HistoryServiceData::Bit()); AddComponents(HistoryServiceData::Bit());
@ -2706,7 +2708,7 @@ void HistoryItem::setAyuHint(const QString &hint) {
else { else {
const auto data = Get<HistoryServiceData>(); const auto data = Get<HistoryServiceData>();
auto prepared = PreparedServiceText{ auto prepared = PreparedServiceText{
.text = _text.append(" ").append(hint), .text = _text.append(QString(" (%1)").arg(hint)),
.links = data->textLinks .links = data->textLinks
}; };
setServiceText(std::move(prepared)); setServiceText(std::move(prepared));