Gmail: hide archived message when moving to sent/trash/spam

pull/209/head
M66B 2 years ago
parent a6b4e15d3d
commit 67616b06ea

@ -417,6 +417,13 @@ public interface DaoMessage {
" AND msgid = :msgid") " AND msgid = :msgid")
List<EntityMessage> getMessagesByMsgId(long account, String msgid); List<EntityMessage> getMessagesByMsgId(long account, String msgid);
@Query("SELECT message.* FROM message" +
" JOIN folder ON folder.id = message.folder" +
" WHERE message.account = :account" +
" AND folder.type = :folderType" +
" AND message.msgid = :msgid")
EntityMessage getMessage(long account, String folderType, String msgid);
@Query("SELECT * FROM message" + @Query("SELECT * FROM message" +
" WHERE account = :account" + " WHERE account = :account" +
" AND inreplyto = :inreplyto") " AND inreplyto = :inreplyto")

@ -280,10 +280,22 @@ public class EntityOperation {
if (!message.ui_deleted) if (!message.ui_deleted)
db.message().setMessageUiHide(message.id, true); db.message().setMessageUiHide(message.id, true);
if (account != null && account.isGmail() && if (account != null && account.isGmail()) {
EntityFolder.ARCHIVE.equals(source.type) && if (EntityFolder.ARCHIVE.equals(source.type) &&
!(EntityFolder.TRASH.equals(target.type) || EntityFolder.JUNK.equals(target.type))) !(EntityFolder.SENT.equals(target.type) ||
name = COPY; EntityFolder.TRASH.equals(target.type) ||
EntityFolder.JUNK.equals(target.type)))
name = COPY;
if (!TextUtils.isEmpty(message.msgid) && !TextUtils.isEmpty(message.hash) &&
(EntityFolder.SENT.equals(target.type) ||
EntityFolder.TRASH.equals(target.type) ||
EntityFolder.JUNK.equals(target.type))) {
EntityMessage archived = db.message().getMessage(message.account, EntityFolder.ARCHIVE, message.msgid);
if (archived != null && message.hash.equals(archived.hash))
db.message().setMessageUiHide(archived.id, true);
}
}
if (account != null && account.isGmail() && if (account != null && account.isGmail() &&
(EntityFolder.DRAFTS.equals(source.type) || EntityFolder.DRAFTS.equals(target.type))) (EntityFolder.DRAFTS.equals(source.type) || EntityFolder.DRAFTS.equals(target.type)))

Loading…
Cancel
Save