summary refs log tree commit diff
path: root/src/notifications/Manager.cpp
diff options
context:
space:
mode:
authorLoren Burkholder <computersemiexpert@outlook.com>2021-02-20 12:06:43 -0500
committerNicolas Werner <nicolas.werner@hotmail.de>2021-03-17 19:17:14 +0100
commitd8fb4d92929eefa1a0d982bac2bcfd7db21fcb7e (patch)
treed492fcf5a64f760af2bcc2fd48b67e304f83ac57 /src/notifications/Manager.cpp
parentSimplify determination of whether markup is supported (diff)
downloadnheko-d8fb4d92929eefa1a0d982bac2bcfd7db21fcb7e.tar.xz
Simplify message body construction
Diffstat (limited to 'src/notifications/Manager.cpp')
-rw-r--r--src/notifications/Manager.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/notifications/Manager.cpp b/src/notifications/Manager.cpp
index dda06299..6550445d 100644
--- a/src/notifications/Manager.cpp
+++ b/src/notifications/Manager.cpp
@@ -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);
 }