Fixed reply all (2)

pull/156/head
M66B 6 years ago
parent a63c8ae5e4
commit 6f87a5d943

@ -3231,9 +3231,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
private void onActionReplyMenu(final ActionData data) {
int cc = (data.message.cc == null ? 0 : data.message.cc.length);
Address[] all = data.message.getAll();
if (cc == 0 &&
if (all.length == 0 &&
data.message.list_post == null &&
data.message.receipt_to == null &&
(answers == 0 && Helper.isPro(context))) {
@ -3244,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(cc > 1);
popupMenu.getMenu().findItem(R.id.menu_reply_to_all).setVisible(all.length > 0);
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));

@ -32,7 +32,10 @@ import androidx.room.PrimaryKey;
import java.io.File;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.Random;
@ -156,6 +159,19 @@ public class EntityMessage implements Serializable {
return sb.toString();
}
Address[] getAll() {
List<Address> addresses = new ArrayList<>();
if (reply != null && reply.length > 0)
addresses.addAll(Arrays.asList(reply));
else if (to != null)
addresses.addAll(Arrays.asList(to));
if (cc != null)
addresses.addAll(Arrays.asList(cc));
return addresses.toArray(new Address[0]);
}
File getFile(Context context) {
File dir = new File(context.getFilesDir(), "messages");
if (!dir.exists())

@ -2064,25 +2064,11 @@ public class FragmentCompose extends FragmentBase {
}
}
if ("reply_all".equals(action)) {
// Remove self from cc
List<Address> ccs = new ArrayList<>();
if (ref.cc != null)
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 iemail = MessageHelper.canonicalAddress(identity.email);
if (email.equals(iemail))
ccs.remove(cc);
}
}
draft.cc = ccs.toArray(new Address[0]);
} else if ("receipt".equals(action)) {
if ("reply_all".equals(action))
draft.cc = ref.getAll();
else if ("receipt".equals(action))
draft.receipt_request = true;
}
} else if ("forward".equals(action)) {
draft.thread = draft.msgid; // new thread
draft.from = ref.to;

Loading…
Cancel
Save