Commit e6646267 authored by Robert Speicher's avatar Robert Speicher

Merge branch '38355-user-popovers-don-t-work-in-system-notes' into 'master'

Add user popovers to system notes

See merge request gitlab-org/gitlab!24241
parents 5a56f282 276371fb
......@@ -16,7 +16,7 @@ $.fn.renderGFM = function renderGFM() {
renderMath(this.find('.js-render-math'));
renderMermaid(this.find('.js-render-mermaid'));
highlightCurrentUser(this.find('.gfm-project_member').get());
initUserPopovers(this.find('.gfm-project_member').get());
initUserPopovers(this.find('.js-user-link').get());
initMRPopovers(this.find('.gfm-merge_request').get());
renderMetrics(this.find('.js-render-metrics').get());
return this;
......
---
title: Add user popovers to system notes
merge_request: 24241
author:
type: fixed
......@@ -106,7 +106,7 @@ module Banzai
end
def link_class
reference_class(:project_member, tooltip: false)
[reference_class(:project_member, tooltip: false), "js-user-link"].join(" ")
end
def link_to_all(link_content: nil)
......
......@@ -3,6 +3,8 @@
require 'spec_helper'
describe 'User sees user popover', :js do
include Spec::Support::Helpers::Features::NotesHelpers
let_it_be(:project) { create(:project, :repository) }
let(:user) { project.creator }
let(:merge_request) do
......@@ -17,13 +19,13 @@ describe 'User sees user popover', :js do
subject { page }
describe 'hovering over a user link in a merge request' do
let(:popover_selector) { '.user-popover' }
before do
visit project_merge_request_path(project, merge_request)
end
it 'displays user popover' do
popover_selector = '.user-popover'
find('.js-user-link').hover
expect(page).to have_css(popover_selector, visible: true)
......@@ -32,5 +34,17 @@ describe 'User sees user popover', :js do
expect(page).to have_content(user.name)
end
end
it "displays user popover in system note" do
add_note("/assign @#{user.username}")
wait_for_requests
find('.system-note-message .js-user-link').hover
page.within(popover_selector) do
expect(page).to have_content(user.name)
end
end
end
end
......@@ -123,7 +123,7 @@ describe Banzai::Filter::UserReferenceFilter do
it 'includes default classes' do
doc = reference_filter("Hey #{reference}")
expect(doc.css('a').first.attr('class')).to eq 'gfm gfm-project_member'
expect(doc.css('a').first.attr('class')).to eq 'gfm gfm-project_member js-user-link'
end
context 'when a project is not specified' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment