You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2014/01/28 17:40:16 UTC

git commit: [#7109] use user.url() instead of constructing /u/username manually; add sender's name

Updated Branches:
  refs/heads/db/7109 [created] 533d3f0a5


[#7109] use user.url() instead of constructing /u/username manually; add sender's name

Using 'user' variable instead of 'username' also allows for more flexibility with
anyone that overrides this template for customizations.


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/533d3f0a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/533d3f0a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/533d3f0a

Branch: refs/heads/db/7109
Commit: 533d3f0a5476b58f6ec85596003a5bd272a3591e
Parents: b15ef35
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Tue Jan 28 16:26:18 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Tue Jan 28 16:39:50 2014 +0000

----------------------------------------------------------------------
 Allura/allura/ext/user_profile/templates/message.html | 2 +-
 Allura/allura/model/auth.py                           | 6 +++++-
 Allura/allura/tests/functional/test_user_profile.py   | 4 ++--
 3 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/533d3f0a/Allura/allura/ext/user_profile/templates/message.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/user_profile/templates/message.html b/Allura/allura/ext/user_profile/templates/message.html
index f06e1d4..d354b4d 100644
--- a/Allura/allura/ext/user_profile/templates/message.html
+++ b/Allura/allura/ext/user_profile/templates/message.html
@@ -20,5 +20,5 @@
 
 ---
 
-This message was sent to you via the {{site_name}} web mail form.  You may reply to this message directly, or at {{base_url}}/u/{{username}}/profile/send_message
+This message was sent to you via the {{site_name}} web mail form.  You may reply to this message directly, or send a message to {{user.display_name or user.username}} at {{base_url}}{{user.url()}}profile/send_message
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/533d3f0a/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index bac0568..542b1f6 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -415,7 +415,7 @@ class User(MappedClass, ActivityNode, ActivityObject):
             'message_text': message,
             'site_name': config['site_name'],
             'base_url': config['base_url'],
-            'username': c.user.username,
+            'user': c.user,
         }
         allura.tasks.mail_tasks.sendsimplemail.post(
             toaddr=user.get_pref('email_address'),
@@ -588,6 +588,10 @@ class User(MappedClass, ActivityNode, ActivityObject):
         return retval
 
     def url(self):
+        '''
+        Return the URL (relative to root domain) for this user's user-project.
+        This includes any special handling via the Auth Provider to determine the proper user-project name
+        '''
         return '/%s/' % plugin.AuthenticationProvider.get(request).user_project_shortname(self)
 
     @memoize

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/533d3f0a/Allura/allura/tests/functional/test_user_profile.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_user_profile.py b/Allura/allura/tests/functional/test_user_profile.py
index 6aa4629..6f01e6a 100644
--- a/Allura/allura/tests/functional/test_user_profile.py
+++ b/Allura/allura/tests/functional/test_user_profile.py
@@ -81,7 +81,7 @@ class TestUserProfile(TestController):
 
         sendsimplemail.post.assert_called_once_with(
             cc=User.by_username('test-admin').get_pref('email_address'),
-            text=u'test message\n\n---\n\nThis message was sent to you via the Allura web mail form.  You may reply to this message directly, or at http://localhost/u/test-admin/profile/send_message\n',
+            text=u'test message\n\n---\n\nThis message was sent to you via the Allura web mail form.  You may reply to this message directly, or send a message to Test Admin at http://localhost/u/test-admin/profile/send_message\n',
             toaddr=User.by_username('test-user').get_pref('email_address'),
             fromaddr=User.by_username('test-admin').get_pref('email_address'),
             reply_to=User.by_username('test-admin').get_pref('email_address'),
@@ -94,7 +94,7 @@ class TestUserProfile(TestController):
 
         sendsimplemail.post.assert_called_once_with(
             cc=None,
-            text=u'test message\n\n---\n\nThis message was sent to you via the Allura web mail form.  You may reply to this message directly, or at http://localhost/u/test-admin/profile/send_message\n',
+            text=u'test message\n\n---\n\nThis message was sent to you via the Allura web mail form.  You may reply to this message directly, or send a message to Test Admin at http://localhost/u/test-admin/profile/send_message\n',
             toaddr=User.by_username('test-user').get_pref('email_address'),
             fromaddr=User.by_username('test-admin').get_pref('email_address'),
             reply_to=User.by_username('test-admin').get_pref('email_address'),