1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 17:57:16 +00:00

Low light archive/sent folder name when message duplicate

This commit is contained in:
M66B 2018-11-22 11:24:52 +01:00
parent 127156d12a
commit 45af78725a
4 changed files with 23 additions and 9 deletions

View file

@ -360,8 +360,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
tvFolder.setText(message.folderDisplay == null
? Helper.localizeFolderName(context, message.folderName)
: message.folderDisplay);
tvFolder.setAlpha(EntityFolder.ARCHIVE.equals(message.folderType) ||
EntityFolder.SENT.equals(message.folderType) ? 0.5f : 1.0f);
tvFolder.setAlpha(message.duplicate ? 0.5f : 1.0f);
}
tvFolder.setVisibility(viewType == ViewType.FOLDER ? View.GONE : View.VISIBLE);

View file

@ -49,6 +49,7 @@ public interface DaoMessage {
" AND NOT folder.type = '" + EntityFolder.OUTBOX + "'" +
" AND NOT folder.type = '" + EntityFolder.DRAFTS + "' THEN 0 ELSE 1 END) AS unflagged" +
", (SELECT COUNT(a.id) FROM attachment a WHERE a.message = message.id) AS attachments" +
", 0 AS duplicate" +
", MAX(CASE WHEN folder.unified THEN message.id ELSE 0 END) AS dummy" +
" FROM message" +
" JOIN account ON account.id = message.account" +
@ -80,6 +81,7 @@ public interface DaoMessage {
" AND NOT (folder.id <> :folder AND folder.type = '" + EntityFolder.OUTBOX + "')" +
" AND NOT (folder.id <> :folder AND folder.type = '" + EntityFolder.DRAFTS + "') THEN 0 ELSE 1 END) AS unflagged" +
", (SELECT COUNT(a.id) FROM attachment a WHERE a.message = message.id) AS attachments" +
", 0 AS duplicate" +
", MAX(CASE WHEN folder.id = :folder THEN message.id ELSE 0 END) AS dummy" +
" FROM message" +
" JOIN account ON account.id = message.account" +
@ -106,6 +108,16 @@ public interface DaoMessage {
", CASE WHEN message.ui_seen THEN 0 ELSE 1 END AS unseen" +
", CASE WHEN message.ui_flagged THEN 0 ELSE 1 END AS unflagged" +
", (SELECT COUNT(a.id) FROM attachment a WHERE a.message = message.id) AS attachments" +
", ((folder.type = '" + EntityFolder.ARCHIVE + "' " +
" OR folder.type = '" + EntityFolder.SENT + "')" +
" AND EXISTS (" +
" SELECT * FROM message m1" +
" JOIN folder f1 ON f1.id = m1.folder" +
" WHERE m1.id <> message.id" +
" AND m1.msgid = message.msgid" +
" AND f1.type <> folder.type)) AS duplicate" +
" FROM message" +
" JOIN account ON account.id = message.account" +
" LEFT JOIN identity ON identity.id = message.identity" +
@ -177,6 +189,7 @@ public interface DaoMessage {
", CASE WHEN message.ui_seen THEN 0 ELSE 1 END AS unseen" +
", CASE WHEN message.ui_flagged THEN 0 ELSE 1 END AS unflagged" +
", (SELECT COUNT(a.id) FROM attachment a WHERE a.message = message.id) AS attachments" +
", 0 AS duplicate" +
" FROM message" +
" JOIN account ON account.id = message.account" +
" LEFT JOIN identity ON identity.id = message.identity" +
@ -191,6 +204,7 @@ public interface DaoMessage {
", 1 AS unseen" +
", 0 AS unflagged" +
", 0 AS attachments" +
", 0 AS duplicate" +
" FROM message" +
" JOIN account ON account.id = message.account" +
" LEFT JOIN identity ON identity.id = message.identity" +

View file

@ -1906,7 +1906,8 @@ public class ServiceSynchronize extends LifecycleService {
" folder=" + dfolder.type + ":" + dup.folder + "/" + folder.type + ":" + folder.id +
" msgid=" + dup.msgid + " thread=" + dup.thread);
if (dup.folder.equals(folder.id) || outbox) {
if (!EntityFolder.ARCHIVE.equals(dfolder.type) &&
dup.folder.equals(folder.id) || outbox) {
String thread = helper.getThreadId(uid);
Log.i(Helper.TAG, folder.name + " found as id=" + dup.id + "/" + uid +
" msgid=" + msgid + " thread=" + thread);
@ -1966,11 +1967,9 @@ public class ServiceSynchronize extends LifecycleService {
message.identity = (identity == null ? null : identity.id);
message.uid = uid;
if (!EntityFolder.ARCHIVE.equals(folder.type)) {
message.msgid = helper.getMessageID();
if (TextUtils.isEmpty(message.msgid))
Log.w(Helper.TAG, "No Message-ID id=" + message.id + " uid=" + message.uid);
}
message.msgid = helper.getMessageID();
if (TextUtils.isEmpty(message.msgid))
Log.w(Helper.TAG, "No Message-ID id=" + message.id + " uid=" + message.uid);
message.references = TextUtils.join(" ", helper.getReferences());
message.inreplyto = helper.getInReplyTo();

View file

@ -29,6 +29,7 @@ public class TupleMessageEx extends EntityMessage {
public int unseen;
public int unflagged;
public int attachments;
public boolean duplicate;
@Override
public boolean equals(Object obj) {
@ -43,7 +44,8 @@ public class TupleMessageEx extends EntityMessage {
this.count == other.count &&
this.unseen == other.unseen &&
this.unflagged == other.unflagged &&
this.attachments == other.attachments);
this.attachments == other.attachments &&
this.duplicate == other.duplicate);
}
return super.equals(obj);
}