Skip to content

Commit

Permalink
Merge pull request #14058 from hellcp-work/multi-comments
Browse files Browse the repository at this point in the history
Fix diff comments not working in multi action requests
  • Loading branch information
hellcp-work authored Apr 3, 2023
2 parents 8e61d38 + 4383013 commit 0e1c09b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/api/app/components/diff_component.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
.diff-comments
-# rubocop:disable ViewComponent/AvoidGlobalState
- if User.session
= link_to(request_inline_comment_path(commentable.bs_request, commentable, id),
= link_to(request_inline_comment_path(commentable.bs_request, request_action_id: commentable, line: id),
class: 'btn btn-sm btn-primary line-new-comment', remote: true, title: 'Add comment') do
%i.fas.fa-comment-medical
.visually-hidden
Expand Down
4 changes: 3 additions & 1 deletion src/api/app/lib/routes_helper/routes_constraints.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ module RoutesConstraints
repository_publish_build_id: %r{[^/]*},
workflow_project: %r{[^/]*},
staging_project_name: %r{[^/]*},
staging_project_copy_name: %r{[^/]*}
staging_project_copy_name: %r{[^/]*},
request_action_id: /\d*/,
line: /diff_\d*_n\d*/
}.freeze
end
end
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- if User.session
= link_to(request_inline_comment_path(commentable.bs_request, commentable, diff_ref),
= link_to(request_inline_comment_path(commentable.bs_request, request_action_id: commentable, line: diff_ref),
class: 'btn btn-sm btn-primary line-new-comment', remote: true, title: 'Add comment') do
%i.fas.fa-comment-medical
.visually-hidden
Expand Down
2 changes: 1 addition & 1 deletion src/api/config/routes/webui_routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
post 'request/set_bugowner_request' => :set_bugowner_request
get 'request/:number/request_action/:id' => :request_action, as: 'request_action'
get 'request/:number/request_action/:id/changes' => :request_action_changes, as: 'request_action_changes'
get 'request/:number/request_action/:id/inline_comment/:line' => :inline_comment, constraints: cons, as: 'request_inline_comment'
get 'request/:number/request_action/:request_action_id/inline_comment/:line' => :inline_comment, constraints: cons, as: 'request_inline_comment'
end

resources :requests, only: [], param: :number, controller: 'webui/bs_requests' do
Expand Down

0 comments on commit 0e1c09b

Please sign in to comment.