You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2012/12/14 16:03:30 UTC
[48/50] git commit: [#4805] ticket:225 added a link back to the thread
[#4805] ticket:225 added a link back to the thread
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/aec4edfe
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/aec4edfe
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/aec4edfe
Branch: refs/heads/ph/4655
Commit: aec4edfecf73ee198de5a3e7f1f40a6ed58fd5ec
Parents: cef0677
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Wed Dec 5 10:34:42 2012 +0000
Committer: Yuriy Arhipov <yu...@yandex.ru>
Committed: Tue Dec 11 14:36:43 2012 +0400
----------------------------------------------------------------------
Allura/allura/model/notification.py | 6 ++++--
Allura/allura/templates/mail/Discussion.txt | 3 +++
.../forgediscussion/tests/functional/test_forum.py | 9 ++++++---
3 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aec4edfe/Allura/allura/model/notification.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/notification.py b/Allura/allura/model/notification.py
index fe06a95..9269c61 100644
--- a/Allura/allura/model/notification.py
+++ b/Allura/allura/model/notification.py
@@ -118,6 +118,7 @@ class Notification(MappedClass):
idx = artifact.index()
subject_prefix = '[%s:%s] ' % (
c.project.shortname, c.app.config.options.mount_point)
+ post = ''
if topic == 'message':
post = kwargs.pop('post')
text = post.text
@@ -167,8 +168,9 @@ class Notification(MappedClass):
d['text'] = ''
try:
''' Add addional text to the notification e-mail based on the artifact type '''
- template = cls.view.get_template('mail/' + artifact.type_s + '.txt')
- d['text'] += template.render(dict(c=c, g=g, config=config, data=artifact))
+ if artifact.__mongometa__.name in ['forum', 'ticket']:
+ template = cls.view.get_template('mail/' + artifact.type_s + '.txt')
+ d['text'] += template.render(dict(c=c, g=g, config=config, data=artifact, post=post, h=h))
except jinja2.TemplateNotFound:
pass
except:
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aec4edfe/Allura/allura/templates/mail/Discussion.txt
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/mail/Discussion.txt b/Allura/allura/templates/mail/Discussion.txt
new file mode 100644
index 0000000..c63cd08
--- /dev/null
+++ b/Allura/allura/templates/mail/Discussion.txt
@@ -0,0 +1,3 @@
+
+---
+[{{post.thread.subject}}]({{h.absurl(post.url_paginated())}})
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/aec4edfe/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py b/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
index 93d9023..b46dc20 100644
--- a/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
+++ b/ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
@@ -383,7 +383,10 @@ class TestForum(TestController):
r = self.app.get('/admin/discussion/forums')
assert 'Message posted' in r
r = self.app.get('/discussion/testforum/moderate/')
- n = M.Notification.query.get(text='This is a *test thread*')
+ n = M.Notification.query.get(subject='[test:discussion] Test Thread')
+ post = FM.ForumPost.query.get(text='This is a *test thread*')
+ assert post.url_paginated() in n.text
+ assert '[Test Thread](' in n.text
assert 'noreply' not in n.reply_to_address, n
assert 'testforum@discussion.test.p' in n.reply_to_address, n
@@ -475,7 +478,7 @@ class TestForum(TestController):
params[f.find('select')['name']] = 'testforum'
params[f.find('input',{'style':'width: 90%'})['name']] = 'Post subject'
thread = self.app.post('/discussion/save_new_topic', params=params).follow()
- assert M.Notification.query.find(dict(text='Post text')).count() == 1
+ assert M.Notification.query.find(dict(subject='[test:discussion] Post subject')).count() == 1
r = self.app.get('/discussion/testforum/')
f = r.html.find('form',{'class':'follow_form'})
subscribe_url = f.get('action')
@@ -496,7 +499,7 @@ class TestForum(TestController):
params[field['name']] = field.has_key('value') and field['value'] or ''
params[f.find('textarea')['name']] = 'Reply 2'
thread_reply = self.app.post(str(rep_url), params=params)
- assert M.Notification.query.find(dict(text='Reply 2')).count() == 1
+ assert M.Notification.query.find(dict(subject='[test:discussion] Re: Post subject')).count() == 1
def get_table_rows(self, response, closest_id):
tbody = response.html.find('div', {'id': closest_id}).find('tbody')