Fixed reply all

This commit is contained in:
M66B 2019-05-29 09:14:56 +02:00
parent 74e99f6a3f
commit 5f83e3351a
2 changed files with 12 additions and 23 deletions

View File

@ -3231,19 +3231,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
private void onActionReplyMenu(final ActionData data) {
List<String> recipients = new ArrayList<>();
if (data.message.reply != null)
for (Address reply : data.message.reply)
recipients.add(((InternetAddress) reply).getAddress());
if (data.message.from != null &&
(data.message.reply == null || data.message.reply.length == 0))
for (Address from : data.message.from)
recipients.add(((InternetAddress) from).getAddress());
if (data.message.cc != null)
for (Address cc : data.message.cc)
recipients.add(((InternetAddress) cc).getAddress());
int cc = (data.message.cc == null ? 0 : data.message.cc.length);
if (recipients.size() == 1 &&
if (cc == 0 &&
data.message.list_post == null &&
data.message.receipt_to == null &&
(answers == 0 && Helper.isPro(context))) {
@ -3254,7 +3244,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
View anchor = bnvActions.findViewById(R.id.action_reply);
PopupMenuLifecycle popupMenu = new PopupMenuLifecycle(context, powner, anchor);
popupMenu.inflate(R.menu.menu_reply);
popupMenu.getMenu().findItem(R.id.menu_reply_to_all).setVisible(recipients.size() > 1);
popupMenu.getMenu().findItem(R.id.menu_reply_to_all).setVisible(cc > 1);
popupMenu.getMenu().findItem(R.id.menu_reply_list).setVisible(data.message.list_post != null);
popupMenu.getMenu().findItem(R.id.menu_reply_receipt).setVisible(data.message.receipt_to != null);
popupMenu.getMenu().findItem(R.id.menu_reply_answer).setVisible(answers != 0 || !Helper.isPro(context));

View File

@ -2066,21 +2066,20 @@ public class FragmentCompose extends FragmentBase {
if ("reply_all".equals(action)) {
// Remove self from cc
List<Address> addresses = new ArrayList<>();
if (ref.to != null)
addresses.addAll(Arrays.asList(ref.to));
List<Address> ccs = new ArrayList<>();
if (ref.cc != null)
addresses.addAll(Arrays.asList(ref.cc));
for (Address address : new ArrayList<>(addresses)) {
String cc = MessageHelper.canonicalAddress(((InternetAddress) address).getAddress());
ccs.addAll(Arrays.asList(ref.cc));
for (Address cc : new ArrayList<>(ccs)) {
String email = MessageHelper.canonicalAddress(((InternetAddress) cc).getAddress());
List<TupleIdentityEx> identities = db.identity().getComposableIdentities(ref.account);
for (EntityIdentity identity : identities) {
String email = MessageHelper.canonicalAddress(identity.email);
if (cc.equals(email))
addresses.remove(address);
String iemail = MessageHelper.canonicalAddress(identity.email);
if (email.equals(iemail))
ccs.remove(cc);
}
}
draft.cc = addresses.toArray(new Address[0]);
draft.cc = ccs.toArray(new Address[0]);
} else if ("receipt".equals(action)) {
draft.receipt_request = true;
}