You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2015/04/16 19:05:08 UTC

[11/17] allura git commit: [#6017] ticket:751 Add attachment information to ticket changelog entries

[#6017] ticket:751 Add attachment information to ticket changelog entries


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

Branch: refs/heads/hs/7852
Commit: 130cceccd0c4ce69e0b37cb1977df5bb2b33c20b
Parents: a3f7d44
Author: Aleksey 'LXj' Alekseyev <go...@gmail.com>
Authored: Tue Apr 7 17:22:16 2015 +0300
Committer: Igor Bondarenko <je...@gmail.com>
Committed: Thu Apr 16 10:43:47 2015 +0000

----------------------------------------------------------------------
 ForgeTracker/forgetracker/tracker_main.py | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/130ccecc/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index 4f20d88..2b4e807 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -1389,6 +1389,14 @@ class TicketController(BaseController, FeedController):
 
     @require_post()
     def _update_ticket(self, post_data):
+        def attachments_info(attachments):
+            text = ''
+            for attach in attachments:
+                text = "%s %s (%s; %s) " % (
+                    text, attach.filename,
+                    h.do_filesizeformat(attach.length), attach.content_type)
+            return text
+
         require_access(self.ticket, 'update')
         changes = changelog()
         comment = post_data.pop('comment', None)
@@ -1424,7 +1432,9 @@ class TicketController(BaseController, FeedController):
 
         if 'attachment' in post_data:
             attachment = post_data['attachment']
+            changes['attachments'] = attachments_info(self.ticket.attachments)
             self.ticket.add_multiple_attachments(attachment)
+            changes['attachments'] = attachments_info(self.ticket.attachments)
         for cf in c.app.globals.custom_fields or []:
             if 'custom_fields.' + cf.name in post_data:
                 value = post_data['custom_fields.' + cf.name]