]> source.dussan.org Git - redmine.git/commitdiff
Merged r11461, r11462 from trunk (#13251).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 24 Feb 2013 10:06:27 +0000 (10:06 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 24 Feb 2013 10:06:27 +0000 (10:06 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/2.3-stable@11463 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/issue_relations_controller.rb
app/models/issue.rb
test/functional/issue_relations_controller_test.rb

index bd2d2c42fc3ef279c3258e3f2d3c2419c8cf5fb8..cd008529ac2c787fd413431ef5598184b6e23de0 100644 (file)
@@ -50,7 +50,7 @@ class IssueRelationsController < ApplicationController
     respond_to do |format|
       format.html { redirect_to issue_path(@issue) }
       format.js {
-        @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
+        @relations = @issue.reload.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
       }
       format.api {
         if saved
index 43c298b778ce278ede73ba400825912b8a333eed..4b95cc0116f94130d9cc2296e9d4e842710bad8c 100644 (file)
@@ -187,6 +187,7 @@ class Issue < ActiveRecord::Base
   def reload(*args)
     @workflow_rule_by_attribute = nil
     @assignable_versions = nil
+    @relations = nil
     super
   end
 
index 61d3612c1f91e85427d2ffdc25a7717d928622ef..04a369b6dd01257ae147f6680ebfa6911939688e 100644 (file)
@@ -28,7 +28,8 @@ class IssueRelationsControllerTest < ActionController::TestCase
            :issue_relations,
            :enabled_modules,
            :enumerations,
-           :trackers
+           :trackers,
+           :projects_trackers
 
   def setup
     User.current = nil
@@ -87,6 +88,17 @@ class IssueRelationsControllerTest < ActionController::TestCase
     end
   end
 
+  def test_create_follows_relation_should_update_relations_list
+    issue1 = Issue.generate!(:subject => 'Followed issue', :start_date => Date.yesterday, :due_date => Date.today)
+    issue2 = Issue.generate!
+
+    assert_difference 'IssueRelation.count' do
+      xhr :post, :create, :issue_id => issue2.id,
+                 :relation => {:issue_to_id => issue1.id, :relation_type => 'follows', :delay => ''}
+    end
+    assert_match /Followed issue/, response.body
+  end
+
   def test_should_create_relations_with_visible_issues_only
     Setting.cross_project_issue_relations = '1'
     assert_nil Issue.visible(User.find(3)).find_by_id(4)