]> source.dussan.org Git - redmine.git/commitdiff
Merged r22395 from trunk to 5.1-stable (#38493).
authorGo MAEDA <maeda@farend.jp>
Sun, 29 Oct 2023 11:45:56 +0000 (11:45 +0000)
committerGo MAEDA <maeda@farend.jp>
Sun, 29 Oct 2023 11:45:56 +0000 (11:45 +0000)
git-svn-id: https://svn.redmine.org/redmine/branches/5.1-stable@22396 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/issue_relations_controller.rb
app/helpers/issues_helper.rb
app/views/issue_relations/destroy.js.erb
test/functional/issue_relations_controller_test.rb

index 91297ac76831e93472c5b167dbcb2ea39f7c29c5..519cb99226f87c94b5f18430f1e757fc37d9057b 100644 (file)
@@ -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
index 9a40b01882cd52b735babd024edcd032af0062a4..80e3de8554f7a128af9e8bca4fd16fbd6a5bc827 100644 (file)
@@ -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)},
index f5f29d31dc9920916c8f1df326531bc3e2444cb2..49e5fa051b8e80d04f66dc6c345f23554337db7f 100644 (file)
@@ -1 +1,2 @@
 $('#relation-<%= @relation.id %>').remove();
+$(".issues-stat").replaceWith('<%= escape_javascript(render_relations_stats(@issue, @relations)) %>')
index 7bb269ce9b17cfb2078ec9fb19667f3e93eefde1..ff92e1be55b5452f863c6fb72b4d90301e8113d9 100644 (file)
@@ -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