[REM] mail: remove support of [ID] matching in subject in mail gateway
This is an old compatibility code. It is time to remove it as it is not used sinces ages.
This commit is contained in:
@@ -1081,15 +1081,6 @@ class MailThread(models.AbstractModel):
|
||||
return routes
|
||||
|
||||
# 5. Fallback to the provided parameters, if they work
|
||||
if not thread_id:
|
||||
# Legacy: fallback to matching [ID] in the Subject
|
||||
match = tools.res_re.search(tools.decode_message_header(message, 'Subject'))
|
||||
thread_id = match and match.group(1)
|
||||
# Convert into int (bug spotted in 7.0 because of str)
|
||||
try:
|
||||
thread_id = int(thread_id)
|
||||
except:
|
||||
thread_id = False
|
||||
if fallback_model:
|
||||
route = self.message_route_verify(
|
||||
message, message_dict,
|
||||
|
||||
@@ -560,15 +560,8 @@ class TestMailgateway(TestMail):
|
||||
to='noone@example.com>', subject='spam',
|
||||
extra='In-Reply-To: <12321321-openerp-%d-mail.channel@neighbor.com>' % frog_groups.id)
|
||||
|
||||
# 4. Subject contains [<ID>] + model passed to message+process -> only attached to group, but not to mail (not in msg1.child_ids)
|
||||
self.format_and_process(
|
||||
MAIL_TEMPLATE,
|
||||
to='erroneous@example.com', email_from='other6@gmail.com',
|
||||
extra='', subject='Re: [%s] 1' % self.group_public.id, model='mail.channel',
|
||||
msg_id='<1198923581.41972151344608186803.JavaMail.5@agrolait.com>')
|
||||
|
||||
# Test created messages
|
||||
self.assertEqual(len(self.group_public.message_ids), 3, 'message_process: group should contain 6 messages')
|
||||
self.assertEqual(len(self.group_public.message_ids), 2, 'message_process: group should contain 6 messages')
|
||||
self.assertEqual(len(self.group_public.message_ids[0].child_ids), 0, 'message_process: msg1 should not have children')
|
||||
|
||||
@mute_logger('openerp.addons.mail.models.mail_thread', 'openerp.models')
|
||||
|
||||
@@ -403,9 +403,6 @@ email_re = re.compile(r"""([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63})""",
|
||||
# matches a string containing only one email
|
||||
single_email_re = re.compile(r"""^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$""", re.VERBOSE)
|
||||
|
||||
# legacy behavior: match [ID] in the Subject, used with the fallback model of the mail gateway
|
||||
res_re = re.compile(r"\[([0-9]+)\]", re.UNICODE)
|
||||
|
||||
# update command in emails body
|
||||
command_re = re.compile("^Set-([a-z]+) *: *(.+)$", re.I + re.UNICODE)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user