From 8ef3af6f0ee8af3646763f3e1e01aab51eeeba7f Mon Sep 17 00:00:00 2001
From: Alex Shulgin <ash@commandprompt.com>
Date: Mon, 1 Aug 2011 23:59:15 +0300
Subject: [PATCH]  Show URL to attached file in plain text issue email.

---
 app/helpers/application_helper.rb |    6 +++++-
 app/helpers/issues_helper.rb      |    6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index f6b1b2b..05cdc48 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -96,7 +96,11 @@ module ApplicationHelper
     text = options.delete(:text) || attachment.filename
     action = options.delete(:download) ? 'download' : 'show'
 
-    link_to(h(text), {:controller => 'attachments', :action => action, :id => attachment, :filename => attachment.filename }, options)
+    link_to(h(text), route_to_attachment(attachment, action), options)
+  end
+
+  def route_to_attachment(attachment, action = 'show')
+    { :controller => 'attachments', :action => action, :id => attachment, :filename => attachment.filename }
   end
 
   # Generates a link to a SCM revision
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 35feb87..4df8377 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -233,7 +233,11 @@ module IssuesHelper
           l(:text_journal_set_to, :label => label, :value => value)
         end
       when 'attachment'
-        l(:text_journal_added, :label => label, :value => value)
+        s = l(:text_journal_added, :label => label, :value => value)
+        if no_html && !value.blank? && a = Attachment.find_by_id(detail.prop_key)
+          s << ": " + url_for(route_to_attachment(a).merge(:only_path => false))
+        end
+        s
       end
     else
       l(:text_journal_deleted, :label => label, :old => old_value)
-- 
1.7.4.1

