allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [2/3] allura git commit: [#7540] ticket:816 Show attachment links for comment
Date Mon, 13 Jul 2015 20:46:51 GMT
[#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/fb7adce3
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/fb7adce3
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/fb7adce3

Branch: refs/heads/master
Commit: fb7adce380ce6a600203ff0fc1abe7bbef120f9f
Parents: 9d7b26e
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Wed Jul 8 15:00:45 2015 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Mon Jul 13 20:01:44 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/fb7adce3/Allura/allura/model/notification.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/notification.py b/Allura/allura/model/notification.py
index ca1a850..01482f0 100644
--- a/Allura/allura/model/notification.py
+++ b/Allura/allura/model/notification.py
@@ -157,15 +157,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:'):


Mime
View raw message