Simplify message body construction

This commit is contained in:
Loren Burkholder 2021-02-20 12:06:43 -05:00 committed by Nicolas Werner
parent 4a86e14d04
commit d8fb4d9292
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
1 changed files with 5 additions and 8 deletions

View File

@ -16,14 +16,11 @@ NotificationsManager::postNotification(const mtx::responses::Notification &notif
const auto sender = cache::displayName(
room_id, QString::fromStdString(mtx::accessors::sender(notification.event)));
QString text;
if (mtx::accessors::msg_type(notification.event) == mtx::events::MessageType::Emote)
text =
formatNotification("* " + sender + " " +
mtx::accessors::formattedBodyWithFallback(notification.event));
else
text = formatNotification(
sender + ": " + mtx::accessors::formattedBodyWithFallback(notification.event));
QString text =
((mtx::accessors::msg_type(notification.event) == mtx::events::MessageType::Emote)
? "* " + sender + " "
: sender + ": ") +
formatNotification(mtx::accessors::formattedBodyWithFallback(notification.event));
systemPostNotification(room_id, event_id, room_name, sender, text, icon);
}