You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by je...@apache.org on 2015/07/09 10:05:21 UTC

[2/3] allura git commit: [#7540] ticket:816 Show attachment links for comment

[#7540] ticket:816 Show attachment links for comment


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

Branch: refs/heads/ib/7540
Commit: 8842ef815fa2015fd816d7313f03190dd24225d1
Parents: f26b057
Author: Igor Bondarenko <je...@gmail.com>
Authored: Wed Jul 8 15:00:45 2015 +0000
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Wed Jul 8 15:00:45 2015 +0000

----------------------------------------------------------------------
 Allura/allura/model/notification.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/8842ef81/Allura/allura/model/notification.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/notification.py b/Allura/allura/model/notification.py
index 4241c42..25d973d 100644
--- a/Allura/allura/model/notification.py
+++ b/Allura/allura/model/notification.py
@@ -154,15 +154,18 @@ class Notification(MappedClass):
             text = kwargs.get('text') or post.text
             file_info = kwargs.pop('file_info', None)
             if file_info is not None:
-                text = "%s\n\n\nAttachment:" % text
+                text = "%s\n\n\nAttachments:\n" % text
                 if not isinstance(file_info, list):
                     file_info = [file_info]
                 for attach in file_info:
                     attach.file.seek(0, 2)
                     bytecount = attach.file.tell()
                     attach.file.seek(0)
-                    text = "%s %s (%s; %s) " % (
-                        text, attach.filename, h.do_filesizeformat(bytecount), attach.type)
+                    url = h.absurl('{}attachment/{}'.format(
+                        post.url(), h.urlquote(attach.filename)))
+                    text = "%s\n- [%s](%s) (%s; %s)" % (
+                        text, attach.filename, url,
+                        h.do_filesizeformat(bytecount), attach.type)
 
             subject = post.subject or ''
             if post.parent_id and not subject.lower().startswith('re:'):