Commit b1fb7de7 authored by Robert Speicher's avatar Robert Speicher

Merge branch '225213-unfurl-search-page' into 'master'

Add slack unfurl support for /search

See merge request gitlab-org/gitlab!38699
parents ff11d3a2 371f4227
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
- page_title @search_term - page_title @search_term
- @hide_breadcrumbs = true - @hide_breadcrumbs = true
- if @search_results
- page_description(_("%{count} %{scope} for term '%{term}'") % { count: @search_results.formatted_count(@scope), scope: @scope, term: @search_term })
- page_card_attributes("Namespace" => @group&.full_path, "Project" => @project&.full_path)
.page-title-holder.d-sm-flex.align-items-sm-center .page-title-holder.d-sm-flex.align-items-sm-center
%h1.page-title< %h1.page-title<
= _('Search') = _('Search')
......
---
title: Improve unfurling support for /search
merge_request: 38699
author:
type: other
...@@ -333,6 +333,9 @@ msgstr "" ...@@ -333,6 +333,9 @@ msgstr ""
msgid "%{cores} cores" msgid "%{cores} cores"
msgstr "" msgstr ""
msgid "%{count} %{scope} for term '%{term}'"
msgstr ""
msgid "%{count} LOC/commit" msgid "%{count} LOC/commit"
msgstr "" msgstr ""
......
...@@ -33,5 +33,37 @@ RSpec.describe 'search/show' do ...@@ -33,5 +33,37 @@ RSpec.describe 'search/show' do
expect(rendered).to render_template('search/_category') expect(rendered).to render_template('search/_category')
expect(rendered).to render_template('search/_results') expect(rendered).to render_template('search/_results')
end end
context 'unfurling support' do
let(:group) { build(:group) }
let(:search_results) do
instance_double(Gitlab::GroupSearchResults).tap do |double|
allow(double).to receive(:formatted_count).and_return(0)
end
end
before do
assign(:search_results, search_results)
assign(:scope, 'issues')
assign(:group, group)
end
it 'renders meta tags for a group' do
render
expect(view.page_description).to match(/\d+ issues for term '#{search_term}'/)
expect(view.page_card_attributes).to eq("Namespace" => group.full_path)
end
it 'renders meta tags for both group and project' do
project = build(:project, group: group)
assign(:project, project)
render
expect(view.page_description).to match(/\d+ issues for term '#{search_term}'/)
expect(view.page_card_attributes).to eq("Namespace" => group.full_path, "Project" => project.full_path)
end
end
end end
end end
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