Use the account's display name (if set) when rendering /me messages in one-to-one chats.

This commit is contained in:
Molly Miller 2021-01-21 14:17:49 +00:00 committed by Daniel Gultsch
parent 20d0206859
commit ebbf1ff6b1
1 changed files with 6 additions and 1 deletions

View File

@ -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();
}
}