Project

General

Profile

Feature #42699 » order_the_related_issues_by_status_and_priority.patch

Renaud GOSSE, 2025-05-13 09:03

View differences:

app/helpers/issues_helper.rb (revision bb52c65232a15875e89705985fa16b7a7b3fecc0) → app/helpers/issues_helper.rb (date 1746804974202)
201 201
  def render_issue_relations(issue, relations)
202 202
    manage_relations = User.current.allowed_to?(:manage_issue_relations, issue.project)
203 203
    s = ''.html_safe
204
    relations.each do |relation|
204
    # Sort relations by tracker order and then by priority in descending order
205
    sorted_relations = relations.sort_by do |relation|
206
      other_issue = relation.other_issue(issue)
207
      [
208
        other_issue.status.name.downcase, # Sort by status name
209
        -other_issue.priority.position # Use negative value for descending order
210
      ]
211
    end
212

  
213
    sorted_relations.each do |relation|
205 214
      other_issue = relation.other_issue(issue)
206 215
      css = "issue hascontextmenu #{other_issue.css_classes} #{relation.css_classes_for(other_issue)}"
207 216
      buttons =
(2-2/3)