Browse Source

Fixed grouping of messages without thread

main
M66B 6 years ago
parent
commit
539ee934ea
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      app/src/main/java/eu/faircode/email/DaoMessage.java

+ 5
- 2
app/src/main/java/eu/faircode/email/DaoMessage.java View File

@ -37,7 +37,9 @@ public interface DaoMessage {
" JOIN message ON folder = folder.id" + " JOIN message ON folder = folder.id" +
" WHERE folder.type = '" + EntityFolder.TYPE_INBOX + "'" + " WHERE folder.type = '" + EntityFolder.TYPE_INBOX + "'" +
" AND NOT ui_hide" + " AND NOT ui_hide" +
" AND received IN (SELECT MAX(m.received) FROM message m WHERE m.folder = message.folder GROUP BY m.thread)")
" AND received IN (SELECT MAX(m.received) FROM message m WHERE m.folder = message.folder" +
" GROUP BY CASE WHEN m.thread IS NULL THEN m.id ELSE m.thread END)")
// in theory the message id and thread could be the same
LiveData<List<TupleMessageEx>> liveUnifiedInbox(); LiveData<List<TupleMessageEx>> liveUnifiedInbox();
@Query("SELECT message.*, folder.name as folderName, folder.type as folderType" + @Query("SELECT message.*, folder.name as folderName, folder.type as folderType" +
@ -47,7 +49,8 @@ public interface DaoMessage {
" JOIN message ON folder = folder.id" + " JOIN message ON folder = folder.id" +
" WHERE folder.id = :folder" + " WHERE folder.id = :folder" +
" AND NOT ui_hide" + " AND NOT ui_hide" +
" AND received IN (SELECT MAX(m.received) FROM message m WHERE m.folder = message.folder GROUP BY m.thread)")
" AND received IN (SELECT MAX(m.received) FROM message m WHERE m.folder = message.folder" +
" GROUP BY CASE WHEN m.thread IS NULL THEN m.id ELSE m.thread END)")
LiveData<List<TupleMessageEx>> liveMessages(long folder); LiveData<List<TupleMessageEx>> liveMessages(long folder);
@Query("SELECT message.*, folder.name as folderName, folder.type as folderType" + @Query("SELECT message.*, folder.name as folderName, folder.type as folderType" +


Loading…
Cancel
Save