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

arm pushed a commit to branch arm
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git


The following commit(s) were added to refs/heads/arm by this push:
     new 2b7a65b3 #870 - Get email from CC if sent from external domain via 
mailing list
2b7a65b3 is described below

commit 2b7a65b330ebd542ed7fe69e1f1722ab9fd70abb
Author: Alastair McFarlane <[email protected]>
AuthorDate: Fri Mar 13 15:29:20 2026 +0000

    #870 - Get email from CC if sent from external domain via mailing list
---
 atr/tabulate.py | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/atr/tabulate.py b/atr/tabulate.py
index 2030437a..0a0f17ff 100644
--- a/atr/tabulate.py
+++ b/atr/tabulate.py
@@ -155,18 +155,19 @@ async def votes(  # noqa: C901
     tabulated_votes = {}
     start_unixtime = None
     message_count = 0
-    async for _mid, msg in util.thread_messages(thread_id):
+    async for mid, msg in util.thread_messages(thread_id):
         message_count += 1
         if message_count > MAX_THREAD_MESSAGES:
             raise ValueError(f"Thread exceeds maximum of {MAX_THREAD_MESSAGES} 
messages")
         from_raw = msg.get("from_raw", "")
-        ok, from_email_lower, asf_uid = _vote_identity(from_raw, email_to_uid)
+        list_raw = msg.get("list_raw", "")
+        cc = msg.get("cc", "").split(",\n")
+        ok, from_email_lower, asf_uid = _vote_identity(from_raw, email_to_uid, 
list_raw, cc)
         if not ok:
             continue
 
         if asf_uid is not None:
             asf_uid_or_email = asf_uid
-            list_raw = msg.get("list_raw", "")
             status = await _vote_status(asf_uid, list_raw, committee)
         else:
             asf_uid_or_email = from_email_lower
@@ -289,7 +290,9 @@ def _vote_continue(line: str) -> bool:
     return False
 
 
-def _vote_identity(from_raw: str, email_to_uid: dict[str, str]) -> tuple[bool, 
str, str | None]:
+def _vote_identity(
+    from_raw: str, email_to_uid: dict[str, str], list_email: str, cc: list[str]
+) -> tuple[bool, str, str | None]:
     from_email_lower = util.email_from_uid(from_raw)
     if not from_email_lower:
         return False, "", None
@@ -297,8 +300,18 @@ def _vote_identity(from_raw: str, email_to_uid: dict[str, 
str]) -> tuple[bool, s
     asf_uid = None
     if from_email_lower.endswith("@apache.org"):
         asf_uid = from_email_lower.split("@")[0]
-    elif from_email_lower in email_to_uid:
-        asf_uid = email_to_uid[from_email_lower]
+    else:
+        raw_name = None
+        if "via" in from_raw and from_email_lower.replace("@", ".") in 
list_email:
+            # Take the last CC, appended by ezmlm, and use that as the email. 
Otherwise, use their name
+            raw_name = from_raw[: from_raw.index("via") - 1]
+            if cc:
+                from_email_lower = util.email_from_uid(cc[-1]) or 
from_email_lower
+        if from_email_lower in email_to_uid:
+            asf_uid = email_to_uid[from_email_lower]
+        elif raw_name:
+            from_email_lower = f"{raw_name} (via {from_email_lower})"
+
     return True, from_email_lower, asf_uid
 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to