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

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


The following commit(s) were added to refs/heads/master by this push:
     new 92ac07d  Unused and probably broken
92ac07d is described below

commit 92ac07d1a139c988781cc5609734412132998dfc
Author: Sebb <[email protected]>
AuthorDate: Mon Nov 15 17:36:39 2021 +0000

    Unused and probably broken
    
    This fixes #59
---
 server/plugins/messages.py | 56 ----------------------------------------------
 1 file changed, 56 deletions(-)

diff --git a/server/plugins/messages.py b/server/plugins/messages.py
index 5073f7d..60def99 100644
--- a/server/plugins/messages.py
+++ b/server/plugins/messages.py
@@ -311,30 +311,6 @@ async def get_source(session: 
plugins.session.SessionObject, permalink: str = No
     return None
 
 
-def get_list(session, listid, fr=None, to=None, limit=10000):
-    """
-    Loads emails from a specified list.
-    If fr and to are not specified, loads the last 30 days.
-    TODO: use fr and to
-    """
-    res = session.DB.ES.search(
-        index=session.DB.dbs.mbox,
-        size=limit,
-        body={
-            "query": {"bool": {"must": [{"term": {"list_raw": listid}}]}},
-            "sort": [{"epoch": {"order": "asc"}}],
-        },
-    )
-    docs = []
-    for hit in res["hits"]["hits"]:
-        doc = hit["_source"]
-        if plugins.aaa.can_access_email(session, doc):
-            if not session.user:
-                doc = anonymize(doc)
-            docs.append(doc)
-    return docs
-
-
 async def query(
     session: plugins.session.SessionObject,
     query_defuzzed,
@@ -425,38 +401,6 @@ def is_public(session: plugins.session.SessionObject, 
listname):
     return False  # Default to not public
 
 
-async def get_list_stats(session, maxage="90d", admin=False):
-    """
-    Fetches a list of all mailing lists available (and visible).
-    Use the admin flag to override AAA and see everything
-    """
-    daterange = {"gt": "now-%s" % maxage, "lt": "now+1d"}
-    res = session.database.search(
-        index=session.DB.dbs.mbox,
-        size=0,
-        body={
-            "query": {"bool": {"must": [{"range": {"date": daterange}}]}},
-            "aggs": {"listnames": {"terms": {"field": "list_raw", "size": 
10000}}},
-        },
-    )
-    lists = {}
-    for entry in res["aggregations"]["listnames"]["buckets"]:
-
-        # Normalize list name
-        listname = entry["key"].lower()
-
-        # Check access
-        if (
-            is_public(session, listname)
-            or admin
-            or plugins.aaa.can_access_list(session, listname)
-        ):
-            # Change foo.bar.baz to [email protected]
-            listname = listname.strip("<>").replace(".", "@", 1)
-            lists[listname] = entry["doc_count"]
-    return lists
-
-
 async def get_activity_span(session, query_defuzzed):
     """ Fetches the activity span of a search as well as active months within 
that span """
 

Reply via email to