Skip to content

Commit

Permalink
Merge pull request #15865 from saraycp/notification_link_to_request_c…
Browse files Browse the repository at this point in the history
…omment

Scroll to the specific comment on conversation
  • Loading branch information
krauselukas committed Mar 26, 2024
2 parents 0d4bf47 + 8691fbf commit 7feb24d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
%i{ title: 'Comment', class: "fas fa-lg fa-comment #{ level > 1 ? 'd-none' : '' }" }
= render(AvatarComponent.new(name: comment.user.name, email: comment.user.email, size: 35, shape: :circle, custom_css: 'avatars-counter'))
.timeline-item-comment.ms-0.flex-fill.overflow-auto
.comment-bubble.ms-3.position-relative
.comment-bubble.ms-3.position-relative{ id: "comment-#{comment.id}-bubble" }
- if policy(comment).update? || policy(comment).destroy?
.dropdown.dropleft.float-end.mx-3.position-absolute.top-0.end-0
= link_to('#', role: 'button', 'data-bs-toggle': 'dropdown', 'aria-expanded': 'false') do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,8 @@ def notifiable_link_path
when 'Event::RequestStatechange', 'Event::RequestCreate', 'Event::ReviewWanted'
Rails.application.routes.url_helpers.request_show_path(@notification.notifiable.number, notification_id: @notification.id)
when 'Event::CommentForRequest'
# TODO: It would be better to eager load the commentable association with `includes(...)`,
# but it's complicated since this isn't for all notifications and it's nested 2 levels deep.
anchor = if @notification.notifiable.commentable.is_a?(BsRequestAction)
'tab-pane-changes'
anchor = if Flipper.enabled?(:request_show_redesign, @current_user)
"comment-#{@notification.notifiable.id}-bubble"
else
'comments-list'
end
Expand Down

0 comments on commit 7feb24d

Please sign in to comment.