always show 'contact details' on avatar long press in non-anon

This commit is contained in:
Daniel Gultsch 2019-10-09 20:40:42 +02:00
parent c17f2dfd56
commit 2ab65609e4
1 changed files with 6 additions and 3 deletions

View File

@ -13,6 +13,7 @@ import android.view.View;
import eu.siacs.conversations.Config; import eu.siacs.conversations.Config;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.MucOptions; import eu.siacs.conversations.entities.MucOptions;
@ -71,8 +72,8 @@ public final class MucDetailsContextMenuHelper {
startConversation.setVisible(true); startConversation.setVisible(true);
final Contact contact = user.getContact(); final Contact contact = user.getContact();
final User self = conversation.getMucOptions().getSelf(); final User self = conversation.getMucOptions().getSelf();
if (contact != null && contact.showInRoster()) { if ((contact != null && contact.showInRoster()) || mucOptions.isPrivateAndNonAnonymous()) {
showContactDetails.setVisible(!contact.isSelf()); showContactDetails.setVisible(contact == null || !contact.isSelf());
} }
if ((activity instanceof ConferenceDetailsActivity || activity instanceof MucUsersActivity) && user.getRole() == MucOptions.Role.NONE) { if ((activity instanceof ConferenceDetailsActivity || activity instanceof MucUsersActivity) && user.getRole() == MucOptions.Role.NONE) {
invite.setVisible(true); invite.setVisible(true);
@ -135,7 +136,9 @@ public final class MucDetailsContextMenuHelper {
Jid jid = user.getRealJid(); Jid jid = user.getRealJid();
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.action_contact_details: case R.id.action_contact_details:
Contact contact = user.getContact(); final Jid realJid = user.getRealJid();
final Account account = conversation.getAccount();
final Contact contact = realJid == null ? null : account.getRoster().getContact(realJid);
if (contact != null) { if (contact != null) {
activity.switchToContactDetails(contact, fingerprint); activity.switchToContactDetails(contact, fingerprint);
} }