Add "replied" marker to regular reply messages

This commit is contained in:
Loren Burkholder 2021-02-20 13:10:14 -05:00 committed by Nicolas Werner
parent 39576fea96
commit b57b76d948
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9

View file

@ -16,10 +16,17 @@ NotificationsManager::postNotification(const mtx::responses::Notification &notif
const auto sender = cache::displayName( const auto sender = cache::displayName(
room_id, QString::fromStdString(mtx::accessors::sender(notification.event))); room_id, QString::fromStdString(mtx::accessors::sender(notification.event)));
const QString reply = (utils::isReply(notification.event)
? ""
: tr(" replied",
"Used to denote that this message is a reply to another "
"message. Displayed as 'foo replied: message'."));
// the "replied" is only added if this message is not an emote message
QString text = QString text =
((mtx::accessors::msg_type(notification.event) == mtx::events::MessageType::Emote) ((mtx::accessors::msg_type(notification.event) == mtx::events::MessageType::Emote)
? "* " + sender + " " ? "* " + sender + " "
: sender + ": ") + : sender + reply + ": ") +
formatNotification(mtx::accessors::formattedBodyWithFallback(notification.event)); formatNotification(mtx::accessors::formattedBodyWithFallback(notification.event));
systemPostNotification(room_id, event_id, room_name, sender, text, icon); systemPostNotification(room_id, event_id, room_name, sender, text, icon);