mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-26 17:57:16 +00:00
Refactoring
This commit is contained in:
parent
b70816b2c1
commit
09533c315e
3 changed files with 5 additions and 7 deletions
|
@ -924,11 +924,10 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
|
|||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
db.message().setMessageUiHide(id, true);
|
||||
|
||||
EntityMessage message = db.message().getMessage(id);
|
||||
EntityFolder junk = db.folder().getFolderByType(message.account, EntityFolder.JUNK);
|
||||
EntityOperation.queue(db, message, EntityOperation.MOVE, junk.id);
|
||||
db.message().setMessageUiHide(id, true);
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
|
|
|
@ -703,8 +703,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
|
||||
List<EntityFolder> targets = new ArrayList<>();
|
||||
for (EntityFolder folder : folders)
|
||||
if (!folder.hide &&
|
||||
(fid < 0 ? !folder.unified : !folder.id.equals(fid)))
|
||||
if (!folder.hide && (fid < 0 ? !folder.unified : !folder.id.equals(fid)))
|
||||
targets.add(folder);
|
||||
|
||||
EntityFolder.sort(targets);
|
||||
|
@ -747,8 +746,8 @@ public class FragmentMessages extends FragmentEx {
|
|||
message.account, message.thread, message.ui_found);
|
||||
for (EntityMessage threaded : messages) {
|
||||
if (threaded.folder.equals(message.folder)) {
|
||||
db.message().setMessageUiHide(threaded.id, true);
|
||||
EntityOperation.queue(db, threaded, EntityOperation.MOVE, target);
|
||||
db.message().setMessageUiHide(threaded.id, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -314,20 +314,20 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
db.message().setMessageUiIgnored(message.id, true);
|
||||
EntityOperation.queue(db, message, EntityOperation.SEEN, true);
|
||||
} else if ("archive".equals(action)) {
|
||||
db.message().setMessageUiHide(message.id, true);
|
||||
EntityFolder archive = db.folder().getFolderByType(message.account, EntityFolder.ARCHIVE);
|
||||
if (archive == null)
|
||||
archive = db.folder().getFolderByType(message.account, EntityFolder.TRASH);
|
||||
if (archive != null) {
|
||||
EntityOperation.queue(db, message, EntityOperation.SEEN, true);
|
||||
EntityOperation.queue(db, message, EntityOperation.MOVE, archive.id);
|
||||
db.message().setMessageUiHide(message.id, true);
|
||||
}
|
||||
} else if ("trash".equals(action)) {
|
||||
db.message().setMessageUiHide(message.id, true);
|
||||
EntityFolder trash = db.folder().getFolderByType(message.account, EntityFolder.TRASH);
|
||||
if (trash != null) {
|
||||
EntityOperation.queue(db, message, EntityOperation.SEEN, true);
|
||||
EntityOperation.queue(db, message, EntityOperation.MOVE, trash.id);
|
||||
db.message().setMessageUiHide(message.id, true);
|
||||
}
|
||||
} else if ("ignored".equals(action))
|
||||
db.message().setMessageUiIgnored(message.id, true);
|
||||
|
|
Loading…
Reference in a new issue