Project

General

Profile

Defect #38493 » 0001-Fix-to-render-related-issues-view-correctly.patch

Takashi Kato, 2023-04-26 00:57

View differences:

app/controllers/issue_relations_controller.rb
20 20
class IssueRelationsController < ApplicationController
21 21
  helper :issues
22 22

  
23
  before_action :find_issue, :authorize, :only => [:index, :create]
23
  before_action :find_issue, :authorize, :only => [:index, :create, :destroy]
24 24
  before_action :find_relation, :only => [:show, :destroy]
25 25

  
26 26
  accept_api_auth :index, :show, :create, :destroy
......
68 68
    respond_to do |format|
69 69
      format.html {redirect_to issue_path(@issue)}
70 70
      format.js do
71
        @relations = @issue.reload.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible?}
71
        @relations = select_relations(@issue)
72 72
        @unsaved_relations = unsaved_relations
73 73
      end
74 74
      format.api do
......
89 89

  
90 90
    respond_to do |format|
91 91
      format.html {redirect_to issue_path(@relation.issue_from)}
92
      format.js
92
      format.js do
93
        @relations = select_relations(@issue)
94
      end
93 95
      format.api  {render_api_ok}
94 96
    end
95 97
  end
......
123 125
    # ToDo: Find a better method to return an error if the param is missing.
124 126
    ['']
125 127
  end
128

  
129
  def select_relations(issue)
130
    issue.reload.relations.select {|r| r.other_issue(issue) && r.other_issue(issue).visible?}
131
  end
126 132
end
app/helpers/issues_helper.rb
208 208
        if manage_relations
209 209
          link_to(
210 210
            l(:label_relation_delete),
211
            relation_path(relation),
211
            relation_path(relation, issue_id: issue.id),
212 212
            :remote => true,
213 213
            :method => :delete,
214 214
            :data => {:confirm => l(:text_are_you_sure)},
app/views/issue_relations/destroy.js.erb
1 1
$('#relation-<%= @relation.id %>').remove();
2
$(".issues-stat").replaceWith('<%= escape_javascript(render_relations_stats(@issue, @relations)) %>')
(1-1/2)