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
The following commit(s) were added to refs/heads/master by this push:
new fbc3b4d Allow for requiring a message-id to be in a certain list
fbc3b4d is described below
commit fbc3b4d62a71e54014a3bda932df7db2a2bfc74a
Author: Daniel Gruno <[email protected]>
AuthorDate: Wed Dec 29 17:49:17 2021 +0100
Allow for requiring a message-id to be in a certain list
---
server/plugins/messages.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/server/plugins/messages.py b/server/plugins/messages.py
index 50ae7c0..d232cf0 100644
--- a/server/plugins/messages.py
+++ b/server/plugins/messages.py
@@ -216,6 +216,7 @@ async def get_email(
session: plugins.session.SessionObject,
permalink: str = None,
messageid: str = None,
+ listid: str = None,
) -> typing.Optional[dict]:
"""
Returns a matching mbox document or None
@@ -247,10 +248,13 @@ async def get_email(
if len(res["hits"]["hits"]) == 1:
doc = res["hits"]["hits"][0]
elif messageid:
+ bquery = {"query": {"bool": {"must": [{"match": {"message-id":
messageid}}]}}}
+ if listid: # Specific List ID required?
+ bquery = {"query": {"bool": {"must": [{"match": {"message-id":
messageid}}, {"term": {"list_raw": listid}}]}}}
res = await session.database.search(
index=doctype,
size=1,
- body={"query": {"bool": {"must": [{"match": {"message-id":
messageid}}]}}},
+ body=bquery,
)
if len(res["hits"]["hits"]) == 1:
doc = res["hits"]["hits"][0]