summary refs log tree commit diff
path: root/src/notifications/Manager.cpp
diff options
context:
space:
mode:
authorJoseph Donofry <joedonofry@gmail.com>2021-11-03 21:43:11 -0400
committerJoseph Donofry <joedonofry@gmail.com>2021-11-03 21:43:11 -0400
commit743a83c8e6f0b64b21e8042a9eb04ce35c713008 (patch)
treef980bdb8c45e607547f87e48f42144227166aa6c /src/notifications/Manager.cpp
parentMerge remote-tracking branch 'nheko-im/master' into video_player_enhancements (diff)
parentUpdate translations (diff)
downloadnheko-743a83c8e6f0b64b21e8042a9eb04ce35c713008.tar.xz
Update video_player_enhancements with changes from master
Diffstat (limited to 'src/notifications/Manager.cpp')
-rw-r--r--src/notifications/Manager.cpp42
1 files changed, 18 insertions, 24 deletions
diff --git a/src/notifications/Manager.cpp b/src/notifications/Manager.cpp

index be580b08..5d51c6c8 100644 --- a/src/notifications/Manager.cpp +++ b/src/notifications/Manager.cpp
@@ -11,30 +11,24 @@ QString NotificationsManager::getMessageTemplate(const mtx::responses::Notification &notification) { - const auto sender = - cache::displayName(QString::fromStdString(notification.room_id), - QString::fromStdString(mtx::accessors::sender(notification.event))); + const auto sender = + cache::displayName(QString::fromStdString(notification.room_id), + QString::fromStdString(mtx::accessors::sender(notification.event))); - // TODO: decrypt this message if the decryption setting is on in the UserSettings - if (auto msg = std::get_if<mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>( - &notification.event); - msg != nullptr) { - return tr("%1 sent an encrypted message").arg(sender); - } + // TODO: decrypt this message if the decryption setting is on in the UserSettings + if (auto msg = std::get_if<mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>( + &notification.event); + msg != nullptr) { + return tr("%1 sent an encrypted message").arg(sender); + } - if (mtx::accessors::msg_type(notification.event) == mtx::events::MessageType::Emote) { - return tr("* %1 %2", - "Format an emote message in a notification, %1 is the sender, %2 the " - "message") - .arg(sender); - } else if (utils::isReply(notification.event)) { - return tr("%1 replied: %2", - "Format a reply in a notification. %1 is the sender, %2 the message") - .arg(sender); - } else { - return tr("%1: %2", - "Format a normal message in a notification. %1 is the sender, %2 the " - "message") - .arg(sender); - } + if (mtx::accessors::msg_type(notification.event) == mtx::events::MessageType::Emote) { + return QString("* %1 %2").arg(sender); + } else if (utils::isReply(notification.event)) { + return tr("%1 replied: %2", + "Format a reply in a notification. %1 is the sender, %2 the message") + .arg(sender); + } else { + return QString("%1: %2").arg(sender); + } }