mirror of
https://github.com/redmine/redmine.git
synced 2025-11-14 01:06:00 +01:00
Fix related issues count not updating after deleting one of the related issues (#38493).
Patch by Takashi Kato. git-svn-id: https://svn.redmine.org/redmine/trunk@22395 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -68,7 +68,7 @@ class IssueRelationsController < ApplicationController
|
||||
respond_to do |format|
|
||||
format.html {redirect_to issue_path(@issue)}
|
||||
format.js do
|
||||
@relations = @issue.reload.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible?}
|
||||
@relations = select_relations(@issue)
|
||||
@unsaved_relations = unsaved_relations
|
||||
end
|
||||
format.api do
|
||||
@@ -89,7 +89,10 @@ class IssueRelationsController < ApplicationController
|
||||
|
||||
respond_to do |format|
|
||||
format.html {redirect_to issue_path(@relation.issue_from)}
|
||||
format.js
|
||||
format.js do
|
||||
find_issue
|
||||
@relations = select_relations(@issue)
|
||||
end
|
||||
format.api {render_api_ok}
|
||||
end
|
||||
end
|
||||
@@ -123,4 +126,8 @@ class IssueRelationsController < ApplicationController
|
||||
# ToDo: Find a better method to return an error if the param is missing.
|
||||
['']
|
||||
end
|
||||
|
||||
def select_relations(issue)
|
||||
issue.reload.relations.select {|r| r.other_issue(issue) && r.other_issue(issue).visible?}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -208,7 +208,7 @@ module IssuesHelper
|
||||
if manage_relations
|
||||
link_to(
|
||||
l(:label_relation_delete),
|
||||
relation_path(relation),
|
||||
relation_path(relation, issue_id: issue.id),
|
||||
:remote => true,
|
||||
:method => :delete,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
$('#relation-<%= @relation.id %>').remove();
|
||||
$(".issues-stat").replaceWith('<%= escape_javascript(render_relations_stats(@issue, @relations)) %>')
|
||||
|
||||
@@ -316,7 +316,7 @@ class IssueRelationsControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
|
||||
assert_difference 'IssueRelation.count', -1 do
|
||||
delete(:destroy, :params => {:id => '2'}, :xhr => true)
|
||||
delete(:destroy, :params => {:id => '2', :issue_id => '2'}, :xhr => true)
|
||||
assert_response :success
|
||||
assert_equal 'text/javascript', response.media_type
|
||||
assert_include 'relation-2', response.body
|
||||
|
||||
Reference in New Issue
Block a user