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 56726ff  tweak and calculate subject hash before comparison
56726ff is described below

commit 56726ff4e08d3ad55ecd89e93e3a1674840393ad
Author: Daniel Gruno <[email protected]>
AuthorDate: Tue Nov 2 01:51:51 2021 +0100

    tweak and calculate subject hash before comparison
---
 server/plugins/messages.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/server/plugins/messages.py b/server/plugins/messages.py
index ca0ea03..53f5e9a 100644
--- a/server/plugins/messages.py
+++ b/server/plugins/messages.py
@@ -537,11 +537,13 @@ class ThreadConstructor:
                 self.hashed_by_subject[tsubject] = xemail
         return self.threads, self.authors
 
+    
     def find_root_subject(self, root_email, osubject=None):
         """Finds the discussion origin of an email, if present"""
         irt = root_email.get("in-reply-to")
         subject = root_email.get("subject")
-        subject = subject.replace("\n", "")  # Crop multi-line subjects
+        subject = subject.replace("\n", "").strip()  # Crop multi-line 
subjects and surrounding whitespace
+        subject = PYPONY_RE_PREFIX.sub("", subject) + "_" + 
root_email.get("list_raw")
 
         # First, the obvious - look for an in-reply-to in our existing dict 
with a matching subject
         if irt and irt in self.hashed_by_msg_id:
@@ -552,14 +554,13 @@ class ThreadConstructor:
         if osubject:
             rsubject = osubject
         else:
-            rsubject = (
-                PYPONY_RE_PREFIX.sub("", subject) + "_" + 
root_email.get("list_raw")
-            )
+            rsubject = subject
         if rsubject and rsubject in self.hashed_by_subject:
             return self.hashed_by_subject[rsubject]
         return None
 
 
+
 def gravatar(eml):
     """Generates a gravatar hash from an email address"""
     if isinstance(eml, str):

Reply via email to