1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-01 04:35:57 +00:00

Always set message lookup URI

This commit is contained in:
M66B 2019-03-14 16:02:27 +00:00
parent 38fcadab9b
commit b4e2894a7a
3 changed files with 14 additions and 3 deletions

View file

@ -1167,7 +1167,6 @@ class Core {
message.inreplyto = helper.getInReplyTo(); message.inreplyto = helper.getInReplyTo();
message.deliveredto = helper.getDeliveredTo(); message.deliveredto = helper.getDeliveredTo();
message.thread = helper.getThreadId(uid); message.thread = helper.getThreadId(uid);
message.sender = MessageHelper.getSortKey(helper.getFrom());
message.from = helper.getFrom(); message.from = helper.getFrom();
message.to = helper.getTo(); message.to = helper.getTo();
message.cc = helper.getCc(); message.cc = helper.getCc();
@ -1191,6 +1190,7 @@ class Core {
message.ui_ignored = seen; message.ui_ignored = seen;
message.ui_browsed = browsed; message.ui_browsed = browsed;
message.sender = MessageHelper.getSortKey(message.from);
Uri lookupUri = ContactInfo.getLookupUri(context, message.from); Uri lookupUri = ContactInfo.getLookupUri(context, message.from);
message.avatar = (lookupUri == null ? null : lookupUri.toString()); message.avatar = (lookupUri == null ? null : lookupUri.toString());

View file

@ -20,6 +20,7 @@ package eu.faircode.email;
*/ */
import android.content.Context; import android.content.Context;
import android.net.Uri;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -217,8 +218,12 @@ public class EntityRule {
if (cc) if (cc)
reply.cc = message.cc; reply.cc = message.cc;
reply.subject = context.getString(R.string.title_subject_reply, message.subject == null ? "" : message.subject); 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.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); reply.id = db.message().insertMessage(reply);
Helper.writeText(reply.getFile(context), body); Helper.writeText(reply.getFile(context), body);
db.message().setMessageContent(reply.id, true, HtmlHelper.getPreview(body), null); db.message().setMessageContent(reply.id, true, HtmlHelper.getPreview(body), null);

View file

@ -1747,6 +1747,8 @@ public class FragmentCompose extends FragmentBase {
} }
draft.sender = MessageHelper.getSortKey(draft.from); 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(); draft.received = new Date().getTime();
@ -2093,13 +2095,17 @@ public class FragmentCompose extends FragmentBase {
// Update draft // Update draft
draft.identity = ident; draft.identity = ident;
draft.extra = extra; draft.extra = extra;
draft.sender = MessageHelper.getSortKey(afrom);
draft.from = afrom; draft.from = afrom;
draft.to = ato; draft.to = ato;
draft.cc = acc; draft.cc = acc;
draft.bcc = abcc; draft.bcc = abcc;
draft.subject = subject; draft.subject = subject;
draft.received = new Date().getTime(); 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); db.message().updateMessage(draft);
Helper.writeText(draft.getFile(context), body); Helper.writeText(draft.getFile(context), body);
db.message().setMessageContent(draft.id, true, HtmlHelper.getPreview(body), null); db.message().setMessageContent(draft.id, true, HtmlHelper.getPreview(body), null);