]> source.dussan.org Git - redmine.git/commitdiff
Fixed that links for relations in notifications do not include hostname (#15677).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 15 Dec 2013 10:32:03 +0000 (10:32 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 15 Dec 2013 10:32:03 +0000 (10:32 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@12415 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb
app/helpers/issues_helper.rb
test/unit/mailer_test.rb

index b83691c0841cae870ba78bf3cbab09beaa88cad7..fac00256582fe149c4d53d9ba60131d66e6723b0 100644 (file)
@@ -79,7 +79,8 @@ module ApplicationHelper
         subject = truncate(subject, :length => options[:truncate])
       end
     end
-    s = link_to text, issue_path(issue), :class => issue.css_classes, :title => title
+    only_path = options[:only_path].nil? ? true : options[:only_path]
+    s = link_to text, issue_path(issue, :only_path => only_path), :class => issue.css_classes, :title => title
     s << h(": #{subject}") if subject
     s = h("#{issue.project} - ") + s if options[:project]
     s
index 9e70f5119d6ad2f9b4118a0d170267c408e3fb71..ed1d243fb88e3094bfcbaab7a8793d1518cf22ba 100644 (file)
@@ -334,11 +334,11 @@ module IssuesHelper
       if detail.value && !detail.old_value
         rel_issue = Issue.visible.find_by_id(detail.value)
         value = rel_issue.nil? ? "#{l(:label_issue)} ##{detail.value}" :
-                  (no_html ? rel_issue : link_to_issue(rel_issue))
+                  (no_html ? rel_issue : link_to_issue(rel_issue, :only_path => options[:only_path]))
       elsif detail.old_value && !detail.value
         rel_issue = Issue.visible.find_by_id(detail.old_value)
         old_value = rel_issue.nil? ? "#{l(:label_issue)} ##{detail.old_value}" :
-                          (no_html ? rel_issue : link_to_issue(rel_issue))
+                          (no_html ? rel_issue : link_to_issue(rel_issue, :only_path => options[:only_path]))
       end
       label = l(detail.prop_key.to_sym)
     end
index 138611bc13b9482c4934bfe900ba21a8940b18ed..9a0ff41eb2ab33be849b0bb5b16604de2aa9a027 100644 (file)
@@ -113,6 +113,16 @@ class MailerTest < ActiveSupport::TestCase
     end
   end
 
+  def test_issue_edit_should_generate_url_with_hostname_for_relations
+    journal = Journal.new(:journalized => Issue.find(1), :user => User.find(1), :created_on => Time.now)
+    journal.details << JournalDetail.new(:property => 'relation', :prop_key => 'label_relates_to', :value => 2)
+    Mailer.deliver_issue_edit(journal)
+    assert_not_nil last_email
+    assert_select_email do
+      assert_select 'a[href=?]', 'http://mydomain.foo/issues/2', :text => 'Feature request #2'
+    end
+  end
+
   def test_generated_links_with_prefix_and_no_relative_url_root
     Setting.default_language = 'en'
     relative_url_root = Redmine::Utils.relative_url_root