Commit 4268668e authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch '332561-search-ui' into 'master'

Use issuable reference prefix in basic search results

See merge request gitlab-org/gitlab!63164
parents 5c54c2fa fba94120
......@@ -220,6 +220,10 @@ module IssuablesHelper
@show_full_reference ? issuable.to_reference(full: true) : issuable.to_reference(@group || @project)
end
def issuable_project_reference(issuable)
"#{issuable.project.full_name} #{issuable.to_reference}"
end
def issuable_initial_data(issuable)
data = {
endpoint: issuable_path(issuable),
......
......@@ -5,6 +5,10 @@
= link_to issuable_path(issuable), data: { track_event: 'click_text', track_label: "#{issuable.class.name.downcase}_title", track_property: 'search_result' }, class: 'gl-w-full' do
%span.term.str-truncated.gl-font-weight-bold.gl-ml-2= issuable.title
.gl-text-gray-500.gl-my-3
= sprintf(s_(' %{project_name}#%{issuable_iid} · created %{issuable_created} by %{author} · updated %{issuable_updated}'), { project_name: issuable.project.full_name, issuable_iid: issuable.iid, issuable_created: time_ago_with_tooltip(issuable.created_at, placement: 'bottom'), issuable_updated: time_ago_with_tooltip(issuable.updated_at, placement: 'bottom'), author: link_to_member(@project, issuable.author, avatar: false) }).html_safe
= issuable_project_reference(issuable)
·
= sprintf(s_('created %{issuable_created} by %{author}'), { issuable_created: time_ago_with_tooltip(issuable.created_at, placement: 'bottom'), author: link_to_member(@project, issuable.author, avatar: false) }).html_safe
·
= sprintf(s_('updated %{time_ago}'), { time_ago: time_ago_with_tooltip(issuable.updated_at, placement: 'bottom') }).html_safe
.description.term.col-sm-10.gl-px-0
= highlight_and_truncate_issuable(issuable, @search_term, @search_highlight)
......@@ -19,9 +19,6 @@ msgstr ""
msgid " %{name}, confirm your email address now! "
msgstr ""
msgid " %{project_name}#%{issuable_iid} · created %{issuable_created} by %{author} · updated %{issuable_updated}"
msgstr ""
msgid " %{start} to %{end}"
msgstr ""
......@@ -38521,6 +38518,9 @@ msgstr ""
msgid "created"
msgstr ""
msgid "created %{issuable_created} by %{author}"
msgstr ""
msgid "created %{timeAgoString} by %{email} via %{user}"
msgstr ""
......
......@@ -29,6 +29,11 @@ RSpec.describe 'User searches for merge requests', :js do
page.within('.results') do
expect(page).to have_link(merge_request1.title)
expect(page).not_to have_link(merge_request2.title)
# Each result should have MR refs like `gitlab-org/gitlab!1`
page.all('.search-result-row').each do |e|
expect(e.text).to match(/!\d+/)
end
end
end
......
......@@ -202,6 +202,20 @@ RSpec.describe IssuablesHelper do
end
end
describe '#issuable_project_reference' do
it 'display project name and simple reference with `#` to an issue' do
issue = build_stubbed(:issue)
expect(helper.issuable_project_reference(issue)).to eq("#{issue.project.full_name} ##{issue.iid}")
end
it 'display project name and simple reference with `!` to an MR' do
merge_request = build_stubbed(:merge_request)
expect(helper.issuable_project_reference(merge_request)).to eq("#{merge_request.project.full_name} !#{merge_request.iid}")
end
end
describe '#updated_at_by' do
let(:user) { create(:user) }
let(:unedited_issuable) { create(:issue) }
......
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