This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git

commit 22502b95d59acd0f44ffc8145f3df6668f052eea
Author: Daniel Gruno <[email protected]>
AuthorDate: Mon Mar 29 11:30:49 2021 +0200

    default to not showing emails with "deleted" set to true
    
    This means we can have emails stored for provenance reasons, but not
    shown to anyone but admins.
---
 server/plugins/mbox.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/server/plugins/mbox.py b/server/plugins/mbox.py
index ef8f548..a6984d2 100644
--- a/server/plugins/mbox.py
+++ b/server/plugins/mbox.py
@@ -301,6 +301,7 @@ async def query(
     query_defuzzed,
     query_limit=10000,
     shorten=False,
+    hide_deleted=True,
 ):
     """
     Advanced query and grab for stats.py
@@ -315,6 +316,9 @@ async def query(
         },
     ):
         doc = hit["_source"]
+        # If email was delete/hidden and we're not doing an admin query, 
ignore it
+        if hide_deleted and doc.get("deleted", False):
+            continue
         doc["id"] = doc["mid"]
         if plugins.aaa.can_access_email(session, doc):
             if not session.credentials:

Reply via email to