show 'send pm' button in anon chats. fixes #3257

This commit is contained in:
Daniel Gultsch 2018-11-03 17:07:02 +01:00
parent f0d5dc583d
commit d8fc03b2f7
1 changed files with 3 additions and 2 deletions

View File

@ -26,7 +26,9 @@ import rocks.xmpp.addr.Jid;
public final class MucDetailsContextMenuHelper { public final class MucDetailsContextMenuHelper {
public static void configureMucDetailsContextMenu(Activity activity, Menu menu, Conversation conversation, User user) { public static void configureMucDetailsContextMenu(Activity activity, Menu menu, Conversation conversation, User user) {
final MucOptions mucOptions = conversation.getMucOptions();
final boolean advancedMode = PreferenceManager.getDefaultSharedPreferences(activity).getBoolean("advanced_muc_mode", false); final boolean advancedMode = PreferenceManager.getDefaultSharedPreferences(activity).getBoolean("advanced_muc_mode", false);
MenuItem sendPrivateMessage = menu.findItem(R.id.send_private_message);
if (user != null && user.getRealJid() != null) { if (user != null && user.getRealJid() != null) {
MenuItem showContactDetails = menu.findItem(R.id.action_contact_details); MenuItem showContactDetails = menu.findItem(R.id.action_contact_details);
MenuItem startConversation = menu.findItem(R.id.start_conversation); MenuItem startConversation = menu.findItem(R.id.start_conversation);
@ -68,9 +70,8 @@ public final class MucDetailsContextMenuHelper {
removeAdminPrivileges.setVisible(true); removeAdminPrivileges.setVisible(true);
} }
} }
sendPrivateMessage.setVisible(!mucOptions.isPrivateAndNonAnonymous() && mucOptions.allowPm() && user.getRole().ranks(MucOptions.Role.VISITOR));
} else { } else {
final MucOptions mucOptions = conversation.getMucOptions();
MenuItem sendPrivateMessage = menu.findItem(R.id.send_private_message);
sendPrivateMessage.setVisible(true); sendPrivateMessage.setVisible(true);
sendPrivateMessage.setEnabled(user != null && mucOptions.allowPm() && user.getRole().ranks(MucOptions.Role.VISITOR)); sendPrivateMessage.setEnabled(user != null && mucOptions.allowPm() && user.getRole().ranks(MucOptions.Role.VISITOR));
} }