##// END OF EJS Templates
Fixed that relations may not be refreshed when adding a follows relation (#13251)....
Jean-Philippe Lang -
r11231:8e17c2aeaccd
parent child
Show More
@@ -50,7 +50,7 class IssueRelationsController < ApplicationController
50 respond_to do |format|
50 respond_to do |format|
51 format.html { redirect_to issue_path(@issue) }
51 format.html { redirect_to issue_path(@issue) }
52 format.js {
52 format.js {
53 @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
53 @relations = @issue.reload.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
54 }
54 }
55 format.api {
55 format.api {
56 if saved
56 if saved
@@ -187,6 +187,7 class Issue < ActiveRecord::Base
187 def reload(*args)
187 def reload(*args)
188 @workflow_rule_by_attribute = nil
188 @workflow_rule_by_attribute = nil
189 @assignable_versions = nil
189 @assignable_versions = nil
190 @relations = nil
190 super
191 super
191 end
192 end
192
193
@@ -87,6 +87,17 class IssueRelationsControllerTest < ActionController::TestCase
87 end
87 end
88 end
88 end
89
89
90 def test_create_follows_relation_should_update_relations_list
91 issue1 = Issue.generate!(:subject => 'Followed issue', :start_date => Date.yesterday, :due_date => Date.today)
92 issue2 = Issue.generate!
93
94 assert_difference 'IssueRelation.count' do
95 xhr :post, :create, :issue_id => issue2.id,
96 :relation => {:issue_to_id => issue1.id, :relation_type => 'follows', :delay => ''}
97 end
98 assert_match /Followed issue/, response.body
99 end
100
90 def test_should_create_relations_with_visible_issues_only
101 def test_should_create_relations_with_visible_issues_only
91 Setting.cross_project_issue_relations = '1'
102 Setting.cross_project_issue_relations = '1'
92 assert_nil Issue.visible(User.find(3)).find_by_id(4)
103 assert_nil Issue.visible(User.find(3)).find_by_id(4)
General Comments 0
You need to be logged in to leave comments. Login now