mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-24 18:03:35 +02:00
Auto link broken threads
This commit is contained in:
@@ -873,12 +873,19 @@ public class MessageHelper {
|
||||
if (!TextUtils.isEmpty(inreplyto) && !refs.contains(inreplyto))
|
||||
refs.add(inreplyto);
|
||||
|
||||
String thread = null;
|
||||
DB db = DB.getInstance(context);
|
||||
for (String ref : refs) {
|
||||
List<EntityMessage> messages = db.message().getMessagesByMsgId(account, ref);
|
||||
if (messages.size() > 0)
|
||||
return messages.get(0).thread;
|
||||
for (EntityMessage message : messages) {
|
||||
if (thread == null)
|
||||
thread = message.thread;
|
||||
if (thread != null && !thread.equals(message.thread))
|
||||
db.message().setMessageThread(message.id, thread);
|
||||
}
|
||||
}
|
||||
if (thread != null)
|
||||
return thread;
|
||||
|
||||
if (refs.size() > 0)
|
||||
return refs.get(0);
|
||||
|
||||
Reference in New Issue
Block a user