diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 783a982328..e92aa9168e 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -1167,7 +1167,6 @@ class Core { message.inreplyto = helper.getInReplyTo(); message.deliveredto = helper.getDeliveredTo(); message.thread = helper.getThreadId(uid); - message.sender = MessageHelper.getSortKey(helper.getFrom()); message.from = helper.getFrom(); message.to = helper.getTo(); message.cc = helper.getCc(); @@ -1191,6 +1190,7 @@ class Core { message.ui_ignored = seen; message.ui_browsed = browsed; + message.sender = MessageHelper.getSortKey(message.from); Uri lookupUri = ContactInfo.getLookupUri(context, message.from); message.avatar = (lookupUri == null ? null : lookupUri.toString()); diff --git a/app/src/main/java/eu/faircode/email/EntityRule.java b/app/src/main/java/eu/faircode/email/EntityRule.java index 58ee015f7a..e73a0deaaa 100644 --- a/app/src/main/java/eu/faircode/email/EntityRule.java +++ b/app/src/main/java/eu/faircode/email/EntityRule.java @@ -20,6 +20,7 @@ package eu.faircode.email; */ import android.content.Context; +import android.net.Uri; import org.json.JSONException; import org.json.JSONObject; @@ -217,8 +218,12 @@ public class EntityRule { if (cc) reply.cc = message.cc; reply.subject = context.getString(R.string.title_subject_reply, message.subject == null ? "" : message.subject); - reply.sender = MessageHelper.getSortKey(reply.from); reply.received = new Date().getTime(); + + reply.sender = MessageHelper.getSortKey(reply.from); + Uri lookupUri = ContactInfo.getLookupUri(context, reply.from); + reply.avatar = (lookupUri == null ? null : lookupUri.toString()); + reply.id = db.message().insertMessage(reply); Helper.writeText(reply.getFile(context), body); db.message().setMessageContent(reply.id, true, HtmlHelper.getPreview(body), null); diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 991678b43b..68dd83d6aa 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -1747,6 +1747,8 @@ public class FragmentCompose extends FragmentBase { } draft.sender = MessageHelper.getSortKey(draft.from); + Uri lookupUri = ContactInfo.getLookupUri(context, draft.from); + draft.avatar = (lookupUri == null ? null : lookupUri.toString()); draft.received = new Date().getTime(); @@ -2093,13 +2095,17 @@ public class FragmentCompose extends FragmentBase { // Update draft draft.identity = ident; draft.extra = extra; - draft.sender = MessageHelper.getSortKey(afrom); draft.from = afrom; draft.to = ato; draft.cc = acc; draft.bcc = abcc; draft.subject = subject; draft.received = new Date().getTime(); + + draft.sender = MessageHelper.getSortKey(draft.from); + Uri lookupUri = ContactInfo.getLookupUri(context, draft.from); + draft.avatar = (lookupUri == null ? null : lookupUri.toString()); + db.message().updateMessage(draft); Helper.writeText(draft.getFile(context), body); db.message().setMessageContent(draft.id, true, HtmlHelper.getPreview(body), null);