From ebbf1ff6b1304c12388828d7b2d166b6d987a2ed Mon Sep 17 00:00:00 2001 From: Molly Miller Date: Thu, 21 Jan 2021 14:17:49 +0000 Subject: [PATCH] Use the account's display name (if set) when rendering /me messages in one-to-one chats. --- src/main/java/eu/siacs/conversations/utils/UIHelper.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/utils/UIHelper.java b/src/main/java/eu/siacs/conversations/utils/UIHelper.java index fbbbe8752..b012fda49 100644 --- a/src/main/java/eu/siacs/conversations/utils/UIHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/UIHelper.java @@ -18,6 +18,7 @@ import java.util.Locale; import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.crypto.axolotl.AxolotlService; +import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Conversational; @@ -521,7 +522,11 @@ public class UIHelper { if (conversation instanceof Conversation && conversation.getMode() == Conversation.MODE_MULTI) { return ((Conversation) conversation).getMucOptions().getSelf().getName(); } else { - final Jid jid = conversation.getAccount().getJid(); + final Account account = conversation.getAccount(); + final Jid jid = account.getJid(); + if (account.getDisplayName() != null) { + return account.getDisplayName(); + } return jid.getLocal() != null ? jid.getLocal() : jid.getDomain().toString(); } }