Filter threads for other accounts

This commit is contained in:
M66B 2020-05-08 13:34:14 +02:00
parent 1a91a4d5b2
commit 5803042a3a
1 changed files with 4 additions and 1 deletions

View File

@ -84,7 +84,10 @@ public interface DaoMessage {
" OR (NOT :found AND :type IS NOT NULL AND ff.type = :type))" +
" AND (NOT mm.ui_hide OR :debug))" +
" GROUP BY account.id, CASE WHEN message.thread IS NULL OR NOT :threading THEN message.id ELSE message.thread END" +
" HAVING (NOT :filter_seen OR SUM(1 - message.ui_seen) > 0)" +
" HAVING (SUM(:found AND message.ui_found) > 0" + // thread can be the same in different accounts
" OR SUM(NOT :found AND :type IS NULL AND folder.unified) > 0" +
" OR SUM(NOT :found AND :type IS NOT NULL AND folder.type = :type) > 0)" +
" AND (NOT :filter_seen OR SUM(1 - message.ui_seen) > 0)" +
" AND (NOT :filter_unflagged OR COUNT(message.id) - SUM(1 - message.ui_flagged) > 0)" +
" AND (NOT :filter_unknown OR SUM(message.avatar IS NOT NULL AND message.sender <> identity.email) > 0)" +
" AND (NOT :filter_snoozed OR message.ui_snoozed IS NULL OR " + is_drafts + ")" +