Skip to content
Snippets Groups Projects
Commit 2b564384 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

interaction: better messages for notifications

Use best name in notifications and show banned members

jami-client-qt#340
Change-Id: I79b76bdf036f32558414a949aebfec0f4700fa10
parent 141b0603
No related branches found
No related tags found
No related merge requests found
...@@ -206,7 +206,7 @@ to_action(const QString& action) ...@@ -206,7 +206,7 @@ to_action(const QString& action)
return ContactAction::JOIN; return ContactAction::JOIN;
else if (action == "remove") else if (action == "remove")
return ContactAction::LEAVE; return ContactAction::LEAVE;
else if (action == "banned") else if (action == "ban")
return ContactAction::BANNED; return ContactAction::BANNED;
return ContactAction::INVALID; return ContactAction::INVALID;
} }
...@@ -219,12 +219,13 @@ getContactInteractionString(const QString& authorUri, const ContactAction& actio ...@@ -219,12 +219,13 @@ getContactInteractionString(const QString& authorUri, const ContactAction& actio
if (authorUri.isEmpty()) { if (authorUri.isEmpty()) {
return QObject::tr("Contact added"); return QObject::tr("Contact added");
} }
return QObject::tr("Invitation received"); return QObject::tr("%1 was invited to join").arg(authorUri);
case ContactAction::JOIN: case ContactAction::JOIN:
return QObject::tr("Invitation accepted"); return QObject::tr("%1 joined").arg(authorUri);
case ContactAction::LEAVE: case ContactAction::LEAVE:
return QObject::tr("Contact left conversation"); return QObject::tr("%1 left").arg(authorUri);
case ContactAction::BANNED: case ContactAction::BANNED:
return QObject::tr("%1 was kicked").arg(authorUri);
case ContactAction::INVALID: case ContactAction::INVALID:
return {}; return {};
} }
...@@ -289,7 +290,6 @@ struct Info ...@@ -289,7 +290,6 @@ struct Info
isRead = false; isRead = false;
if (type == Type::CONTACT) { if (type == Type::CONTACT) {
authorUri = accountURI == message["uri"] ? "" : message["uri"]; authorUri = accountURI == message["uri"] ? "" : message["uri"];
body = getContactInteractionString(authorUri, to_action(message["action"]));
} else if (type == Type::INITIAL) { } else if (type == Type::INITIAL) {
body = QObject::tr("Swarm created"); body = QObject::tr("Swarm created");
} else if (type == Type::CALL) { } else if (type == Type::CALL) {
......
...@@ -2282,6 +2282,13 @@ ConversationModelPimpl::slotConversationLoaded(uint32_t requestId, ...@@ -2282,6 +2282,13 @@ ConversationModelPimpl::slotConversationLoaded(uint32_t requestId,
downloadFile = (bytesProgress == 0); downloadFile = (bytesProgress == 0);
} else if (msg.type == interaction::Type::CALL) { } else if (msg.type == interaction::Type::CALL) {
msg.body = storage::getCallInteractionString(msg.authorUri, msg.duration); msg.body = storage::getCallInteractionString(msg.authorUri, msg.duration);
} else if (msg.type == interaction::Type::CONTACT) {
auto bestName = msg.authorUri == linked.owner.profileInfo.uri
? linked.owner.accountModel->bestNameForAccount(linked.owner.id)
: linked.owner.contactModel->bestNameForContact(msg.authorUri);
msg.body = interaction::getContactInteractionString(bestName,
interaction::to_action(
message["action"]));
} }
insertSwarmInteraction(msgId, msg, conversation, true); insertSwarmInteraction(msgId, msg, conversation, true);
if (downloadFile) { if (downloadFile) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment