Limit identities to accounts with a drafts folder

This commit is contained in:
M66B 2019-01-25 19:27:23 +00:00
parent f2d76246f3
commit d3919e2b5b
2 changed files with 4 additions and 3 deletions

View File

@ -36,8 +36,9 @@ public interface DaoIdentity {
@Query("SELECT identity.*, account.name AS accountName FROM identity" +
" JOIN account ON account.id = identity.account" +
" JOIN folder ON folder.account = identity.account AND folder.type = '" + EntityFolder.DRAFTS + "'" +
" WHERE NOT :synchronize OR account.synchronize")
List<TupleIdentityEx> getIdentities(boolean synchronize);
List<TupleIdentityEx> getComposableIdentities(boolean synchronize);
@Query("SELECT * FROM identity WHERE account = :account")
List<EntityIdentity> getIdentities(long account);

View File

@ -1384,7 +1384,7 @@ public class FragmentCompose extends FragmentBase {
if ("edit".equals(action))
throw new IllegalStateException("Draft not found hide=" + (result.draft != null));
List<TupleIdentityEx> identities = db.identity().getIdentities(true);
List<TupleIdentityEx> identities = db.identity().getComposableIdentities(true);
EntityMessage ref = db.message().getMessage(reference);
if (ref == null) {
@ -1649,7 +1649,7 @@ public class FragmentCompose extends FragmentBase {
@Override
protected List<TupleIdentityEx> onExecute(Context context, Bundle args) {
DB db = DB.getInstance(context);
List<TupleIdentityEx> identities = db.identity().getIdentities(true);
List<TupleIdentityEx> identities = db.identity().getComposableIdentities(true);
if (identities == null)
identities = new ArrayList<>();