Skip to content
Snippets Groups Projects
Commit 6b0adb70 authored by Page Magnier-Slimani's avatar Page Magnier-Slimani
Browse files

notifications: no longer blank notifications when leaving or joining a group

Fixed the issue of blank notification when leaving a group by updating the
OnNewUnreadNotification function.

GitLab: #1921

Change-Id: I87f4c3828a72c9b504a9a68707d6b257ce00154c
parent 217efe60
No related branches found
No related tags found
No related merge requests found
......@@ -171,10 +171,20 @@ ConversationsAdapter::onNewUnreadInteraction(const QString& accountId,
if (interaction.authorUri == accountInfo.profileInfo.uri)
return;
auto from = accountInfo.contactModel->bestNameForContact(interaction.authorUri);
auto body_ = interaction.body;
if (interaction.type == interaction::Type::DATA_TRANSFER) {
body_ = interaction.commit.value("displayName");
QString displayedString;
// Add special handling for member events
if (interaction.type == interaction::Type::CONTACT) {
auto action = interaction.commit.value("action");
if (action == "join") {
displayedString = tr("%1 has joined the conversation.").arg(from);
} else if (action == "remove") {
displayedString = tr("%1 has left the conversation.").arg(from);
}
} else if (interaction.type == interaction::Type::DATA_TRANSFER) {
displayedString = from + ": " + interaction.commit.value("displayName");
} else {
displayedString = from + ": " + interaction.body;
}
auto preferences = accountInfo.conversationModel->getConversationPreferences(convUid);
......@@ -190,7 +200,7 @@ ConversationsAdapter::onNewUnreadInteraction(const QString& accountId,
auto notifId = QString("%1;%2;%3").arg(accountId, convUid, interactionId);
systemTray_->showNotification(notifId,
tr("%1 received a new message").arg(to),
from + ": " + body_,
displayedString,
SystemTray::NotificationType::CHAT,
Utils::QImageToByteArray(contactPhoto));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment