From 9d608d71780c42a0937daefefca08aa0c872d1f5 Mon Sep 17 00:00:00 2001 From: ci2014 Date: Fri, 10 Nov 2017 08:07:17 +0100 Subject: [PATCH] Optimize regex to find parent of mail (#4440) Made the Regex case insensitive and changed the regex to show only the lowercase (which will save some space). Added the aw and wg for german answer and forwarding. I will add more languages based on this list https://en.wikipedia.org/wiki/List_of_email_subject_abbreviations after more research. --- frappe/email/doctype/email_account/email_account.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frappe/email/doctype/email_account/email_account.py b/frappe/email/doctype/email_account/email_account.py index 53cb6b8dd7..5cc56027fc 100755 --- a/frappe/email/doctype/email_account/email_account.py +++ b/frappe/email/doctype/email_account/email_account.py @@ -457,8 +457,8 @@ class EmailAccount(Document): # try and match by subject and sender # if sent by same sender with same subject, # append it to old coversation - subject = frappe.as_unicode(strip(re.sub("(^\s*(Fw|FW|fwd)[^:]*:|\s*(Re|RE)[^:]*:\s*)*", - "", email.subject))) + subject = frappe.as_unicode(strip(re.sub("(^\s*(fw|fwd|wg)[^:]*:|\s*(re|aw)[^:]*:\s*)*", + "", email.subject, 0, flags=re.IGNORECASE))) parent = frappe.db.get_all(self.append_to, filters={ self.sender_field: email.from_email,