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
commit f3cbd7c8173fac47bdf976246a991ed84c2d211c Author: Sebb <[email protected]> AuthorDate: Wed Dec 29 01:39:38 2021 +0000 get_source does not need fetch by Permalink This fixes #201 --- server/plugins/messages.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/server/plugins/messages.py b/server/plugins/messages.py index bbce740..50ae7c0 100644 --- a/server/plugins/messages.py +++ b/server/plugins/messages.py @@ -305,7 +305,6 @@ async def get_email_irt( async def get_source(session: plugins.session.SessionObject, permalink: str = None, raw=False): """ Get the source document for an email, or None if it does not find exactly one match. - If the source cannot be found using the id, it checks for a match by Permalink. The caller must check if access is allowed. """ @@ -315,15 +314,6 @@ async def get_source(session: plugins.session.SessionObject, permalink: str = No doc = await session.database.get(index=doctype, id=permalink) except plugins.database.DBError: doc = None - if not doc: - res = await session.database.search( - index=doctype, - size=1, - body={"query": {"bool": {"must": [{"match": {"permalink": permalink}}]}}}, - ) - if len(res["hits"]["hits"]) == 1: - doc = res["hits"]["hits"][0] - doc["id"] = doc["_id"] if doc: if raw: return doc
