Skip to content

Commit

Permalink
Pass the association to the partial instead of call it two times
Browse files Browse the repository at this point in the history
  • Loading branch information
vpereira committed Nov 4, 2020
1 parent d9844b0 commit 5976901
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/api/app/views/webui/request/_request_comments.html.haml
Expand Up @@ -5,7 +5,7 @@
Comments for request #{bs_request.number}
%span.badge.badge-primary{ id: "comment-counter-request-#{bs_request.number}" }
= comments.size
- bs_request.superseding.includes(:comments).each do |superseded|
- superseded_requests.each do |superseded|
- if superseded.comments.any?
%li.nav-item
= link_to("#superseded-#{superseded.number}", title: "This request was superseded by request #{superseded.superseded_by}",
Expand All @@ -18,7 +18,7 @@
.tab-pane.fade.show.active#comments
= render partial: 'webui/comment/show', locals: { commentable: bs_request,
comment_counter_id: "#comment-counter-request-#{bs_request.number}" }
- bs_request.superseding.includes(:comments).each do |superseded|
- superseded_requests.each do |superseded|
- if superseded.comments.any?
.tab-pane.fade.show{ id: "superseded-#{superseded.number}" }
= render partial: 'webui/comment/show', locals: { commentable: superseded,
Expand Down
3 changes: 2 additions & 1 deletion src/api/app/views/webui/request/show.html.haml
Expand Up @@ -41,7 +41,8 @@
.row
.col-md-8
.card.mb-3#comments-list
= render partial: 'request_comments', locals: { comments: @comments, bs_request: @bs_request }
= render partial: 'request_comments', locals: { comments: @comments, bs_request: @bs_request,
superseded_requests: @bs_request.superseding.includes(:comments) }
= render partial: 'handle_request', locals: { is_target_maintainer: @is_target_maintainer,
is_author: @is_author,
bs_request: @bs_request,
Expand Down

0 comments on commit 5976901

Please sign in to comment.