summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2023-10-29 11:45:56 +0000
committerGo MAEDA <maeda@farend.jp>2023-10-29 11:45:56 +0000
commit67c268476ab38d7e1fa70ae02cd348da702a679a (patch)
tree0238c50e5e9ff76b14ffdadb70d8ab5d9e80066c
parenta5092d8d0dae54739fba0ac7af3465aea8cd0496 (diff)
downloadredmine-67c268476ab38d7e1fa70ae02cd348da702a679a.tar.gz
redmine-67c268476ab38d7e1fa70ae02cd348da702a679a.zip
Merged r22395 from trunk to 5.1-stable (#38493).
git-svn-id: https://svn.redmine.org/redmine/branches/5.1-stable@22396 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/controllers/issue_relations_controller.rb11
-rw-r--r--app/helpers/issues_helper.rb2
-rw-r--r--app/views/issue_relations/destroy.js.erb1
-rw-r--r--test/functional/issue_relations_controller_test.rb2
4 files changed, 12 insertions, 4 deletions
diff --git a/app/controllers/issue_relations_controller.rb b/app/controllers/issue_relations_controller.rb
index 91297ac76..519cb9922 100644
--- a/app/controllers/issue_relations_controller.rb
+++ b/app/controllers/issue_relations_controller.rb
@@ -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
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 9a40b0188..80e3de855 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -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)},
diff --git a/app/views/issue_relations/destroy.js.erb b/app/views/issue_relations/destroy.js.erb
index f5f29d31d..49e5fa051 100644
--- a/app/views/issue_relations/destroy.js.erb
+++ b/app/views/issue_relations/destroy.js.erb
@@ -1 +1,2 @@
$('#relation-<%= @relation.id %>').remove();
+$(".issues-stat").replaceWith('<%= escape_javascript(render_relations_stats(@issue, @relations)) %>')
diff --git a/test/functional/issue_relations_controller_test.rb b/test/functional/issue_relations_controller_test.rb
index 7bb269ce9..ff92e1be5 100644
--- a/test/functional/issue_relations_controller_test.rb
+++ b/test/functional/issue_relations_controller_test.rb
@@ -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