This is an automated email from the ASF dual-hosted git repository. dill0wn pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/allura.git
commit 6b408245d4c57a84acf121097c8438fa713c624a Author: Guillermo Cruz <[email protected]> AuthorDate: Fri Nov 12 13:15:51 2021 -0700 removed email address from FROM: field in form and fixed TestMailTasks --- Allura/allura/model/auth.py | 1 - Allura/allura/tasks/mail_tasks.py | 3 ++- Allura/allura/tests/functional/test_user_profile.py | 4 ++-- Allura/allura/tests/test_tasks.py | 14 +++++++------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py index c656065..1aa71ea 100644 --- a/Allura/allura/model/auth.py +++ b/Allura/allura/model/auth.py @@ -819,7 +819,6 @@ class User(MappedClass, ActivityNode, ActivityObject, SearchIndexable): h = header.Header() h.append('"%s"%s' % (self.get_pref('display_name'), ' ' if six.PY2 else '')) # py2 needs explicit space for unicode/text_type cast of Header - h.append('<%s>' % self.get_pref('email_address')) return h def update_notifications(self): diff --git a/Allura/allura/tasks/mail_tasks.py b/Allura/allura/tasks/mail_tasks.py index c6da880..0df7cc0 100644 --- a/Allura/allura/tasks/mail_tasks.py +++ b/Allura/allura/tasks/mail_tasks.py @@ -176,7 +176,8 @@ def sendmail(fromaddr, destinations, text, reply_to, subject, except Exception: log.exception('Error looking up user with ID: %r' % addr) continue - addr = user.email_address_header() + # retrieve active email address + addr = user.preferences.email_address if not addr and user.email_addresses: addr = user.email_addresses[0] log.warning( diff --git a/Allura/allura/tests/functional/test_user_profile.py b/Allura/allura/tests/functional/test_user_profile.py index 7296de8..0db7d57 100644 --- a/Allura/allura/tests/functional/test_user_profile.py +++ b/Allura/allura/tests/functional/test_user_profile.py @@ -115,7 +115,7 @@ class TestUserProfile(TestController): response = self.app.get( '/u/test-user/profile/send_message', status=200) assert 'you currently have user messages disabled' not in response - response.mustcontain('<b>From:</b> "Test Admin" <[email protected]>') + response.mustcontain('<b>From:</b> "Test Admin"') self.app.post('/u/test-user/profile/send_user_message', params={'subject': 'test subject', @@ -163,7 +163,7 @@ class TestUserProfile(TestController): response = self.app.get( '/u/test-user/profile/send_message', status=200) assert 'you currently have user messages disabled' not in response - response.mustcontain('<b>From:</b> "Test Admin" <[email protected]>') + response.mustcontain('<b>From:</b> "Test Admin"') self.app.post('/u/test-user/profile/send_user_message', params={'subject': 'test subject', 'message': 'test message', diff --git a/Allura/allura/tests/test_tasks.py b/Allura/allura/tests/test_tasks.py index c2663b9..ec664e9 100644 --- a/Allura/allura/tests/test_tasks.py +++ b/Allura/allura/tests/test_tasks.py @@ -271,7 +271,7 @@ class TestMailTasks(unittest.TestCase): assert_equal(rcpts, [c.user.get_pref('email_address')]) assert_in('Reply-To: %s' % g.noreply, body) - assert_in('From: "Test Admin" <[email protected]>', body) + assert_in('From: "Test Admin"', body) assert_in('Subject: Test subject', body) # plain assert_in('This is a test', body) @@ -355,7 +355,7 @@ class TestMailTasks(unittest.TestCase): assert_equal(_client.sendmail.call_count, 1) return_path, rcpts, body = _client.sendmail.call_args[0] body = body.split('\n') - assert_in('From: "Test Admin" <[email protected]>', body) + assert_in('From: "Test Admin"', body) c.user.disabled = True ThreadLocalORMSession.flush_all() @@ -385,7 +385,7 @@ class TestMailTasks(unittest.TestCase): assert_equal(_client.sendmail.call_count, 1) return_path, rcpts, body = _client.sendmail.call_args[0] body = body.split('\n') - assert_in('From: "Test Admin" <[email protected]>', body) + assert_in('From: "Test Admin"', body) assert_in('Sender: [email protected]', body) assert_in('To: [email protected]', body) @@ -401,7 +401,7 @@ class TestMailTasks(unittest.TestCase): assert_equal(_client.sendmail.call_count, 1) return_path, rcpts, body = _client.sendmail.call_args[0] body = body.split('\n') - assert_in('From: "Test Admin" <[email protected]>', body) + assert_in('From: "Test Admin"', body) assert_in('Sender: [email protected]', body) assert_in('To: [email protected]', body) @@ -419,7 +419,7 @@ class TestMailTasks(unittest.TestCase): assert_equal(_client.sendmail.call_count, 1) return_path, rcpts, body = _client.sendmail.call_args[0] body = body.split('\n') - assert_in('From: "Test Admin" <[email protected]>', body) + assert_in('From: "Test Admin"', body) assert_in('References: <a> <b> <c>', body) _client.reset_mock() @@ -434,7 +434,7 @@ class TestMailTasks(unittest.TestCase): assert_equal(_client.sendmail.call_count, 1) return_path, rcpts, body = _client.sendmail.call_args[0] body = body.split('\n') - assert_in('From: "Test Admin" <[email protected]>', body) + assert_in('From: "Test Admin"', body) assert_in('References: <ref>', body) def test_cc(self): @@ -465,7 +465,7 @@ class TestMailTasks(unittest.TestCase): message_id=h.gen_message_id()) assert_equal(_client.sendmail.call_count, 1) return_path, rcpts, body = _client.sendmail.call_args[0] - assert_in('From: "Test Admin" <[email protected]>', body) + assert_in('From: "Test Admin"', body) def test_send_email_long_lines_use_quoted_printable(self): with mock.patch.object(mail_tasks.smtp_client, '_client') as _client:
