You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/11/27 17:52:22 UTC
[1/2] git commit: [#6863] ticket:497 Minor template fix
Updated Branches:
refs/heads/master 3b35ab406 -> ed7b5efac
[#6863] ticket:497 Minor template fix
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/ed7b5efa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/ed7b5efa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/ed7b5efa
Branch: refs/heads/master
Commit: ed7b5efac37b31b629646e4b7d3004ba6568dc07
Parents: e8dbd2e
Author: Igor Bondarenko <je...@gmail.com>
Authored: Wed Nov 27 10:13:38 2013 +0000
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed Nov 27 16:48:37 2013 +0000
----------------------------------------------------------------------
Allura/allura/ext/user_profile/templates/message.html | 4 +++-
Allura/allura/tests/functional/test_user_profile.py | 4 ++--
2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ed7b5efa/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 9e13b3c..f06e1d4 100644
--- a/Allura/allura/ext/user_profile/templates/message.html
+++ b/Allura/allura/ext/user_profile/templates/message.html
@@ -17,6 +17,8 @@
under the License.
-#}
{{message_text}}
---
+
+---
+
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
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ed7b5efa/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 6e4618d..5fb23cd 100644
--- a/Allura/allura/tests/functional/test_user_profile.py
+++ b/Allura/allura/tests/functional/test_user_profile.py
@@ -80,7 +80,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--\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 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'),
@@ -93,7 +93,7 @@ class TestUserProfile(TestController):
sendsimplemail.post.assert_called_once_with(
cc=None,
- text=u'test message\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 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'),
[2/2] git commit: [#6883] ticket:497 add template with footer for
message and fixed test
Posted by jo...@apache.org.
[#6883] ticket:497 add template with footer for message and fixed test
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/e8dbd2e5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/e8dbd2e5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/e8dbd2e5
Branch: refs/heads/master
Commit: e8dbd2e52e53dea2bb9efdd8ac8ea7a5088951b4
Parents: 3b35ab4
Author: Yaroslav Sokolovsky <ya...@gmail.com>
Authored: Thu Nov 21 16:56:40 2013 +0200
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Wed Nov 27 16:48:37 2013 +0000
----------------------------------------------------------------------
.../ext/user_profile/templates/message.html | 22 ++++++++++++++++++++
Allura/allura/model/auth.py | 10 ++++++++-
.../tests/functional/test_user_profile.py | 4 ++--
3 files changed, 33 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e8dbd2e5/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
new file mode 100644
index 0000000..9e13b3c
--- /dev/null
+++ b/Allura/allura/ext/user_profile/templates/message.html
@@ -0,0 +1,22 @@
+{#-
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-#}
+{{message_text}}
+--
+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
+
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e8dbd2e5/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index e3587cf..432898b 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -31,6 +31,7 @@ from datetime import timedelta, datetime, time
import iso8601
import pymongo
+from tg import config
from pylons import tmpl_context as c, app_globals as g
from pylons import request
@@ -384,13 +385,20 @@ class User(MappedClass, ActivityNode, ActivityObject):
"""Send a user message (email) to ``user``.
"""
+ tmpl = g.jinja2_env.get_template('allura:ext/user_profile/templates/message.html')
+ tmpl_context = {
+ 'message_text': message,
+ 'site_name': config['site_name'],
+ 'base_url': config['base_url'],
+ 'username': c.user.username,
+ }
allura.tasks.mail_tasks.sendsimplemail.post(
toaddr=user.get_pref('email_address'),
fromaddr=self.get_pref('email_address'),
reply_to=self.get_pref('email_address'),
message_id=h.gen_message_id(),
subject=subject,
- text=message,
+ text=tmpl.render(tmpl_context),
cc=cc)
self.sent_user_message_times.append(datetime.utcnow())
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/e8dbd2e5/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 7b17d28..6e4618d 100644
--- a/Allura/allura/tests/functional/test_user_profile.py
+++ b/Allura/allura/tests/functional/test_user_profile.py
@@ -80,7 +80,7 @@ class TestUserProfile(TestController):
sendsimplemail.post.assert_called_once_with(
cc=User.by_username('test-admin').get_pref('email_address'),
- text=u'test message',
+ text=u'test message\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',
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'),
@@ -93,7 +93,7 @@ class TestUserProfile(TestController):
sendsimplemail.post.assert_called_once_with(
cc=None,
- text=u'test message',
+ text=u'test message\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',
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'),