From 7f76fbbc988ae9a557acdb78cbfd8906571ea06c Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 7 Aug 2018 17:56:11 +0000 Subject: [PATCH] Fixed grouping of messages without thread --- app/src/main/java/eu/faircode/email/DaoMessage.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/DaoMessage.java b/app/src/main/java/eu/faircode/email/DaoMessage.java index c802bed6..804f2bd7 100644 --- a/app/src/main/java/eu/faircode/email/DaoMessage.java +++ b/app/src/main/java/eu/faircode/email/DaoMessage.java @@ -44,7 +44,7 @@ public interface DaoMessage { " FROM message" + " JOIN folder ON folder.id = message.folder" + " WHERE (NOT message.ui_hide OR :debug)" + - " GROUP BY message.thread" + + " GROUP BY CASE WHEN message.thread IS NULL THEN message.id ELSE message.thread END" + " HAVING SUM(CASE WHEN folder.type = '" + EntityFolder.TYPE_INBOX + "' THEN 1 ELSE 0 END) > 0" + " ORDER BY message.received DESC") DataSource.Factory pagedUnifiedInbox(boolean debug); @@ -57,7 +57,7 @@ public interface DaoMessage { " FROM message" + " JOIN folder ON folder.id = message.folder" + " WHERE (NOT message.ui_hide OR :debug)" + - " GROUP BY message.thread" + + " GROUP BY CASE WHEN message.thread IS NULL THEN message.id ELSE message.thread END" + " HAVING SUM(CASE WHEN folder.id = :folder THEN 1 ELSE 0 END) > 0" + " ORDER BY message.received DESC, message.sent DESC") DataSource.Factory pagedFolder(long folder, boolean debug);