Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a8a42f0d
Commit
a8a42f0d
authored
Sep 23, 2020
by
Dmitry Gruzd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert Bold Issue Search Term feature
This reverts commit
1c3e5127
, reversing changes made to
6cd74b81
.
parent
db820ba2
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
38 additions
and
136 deletions
+38
-136
app/controllers/projects/settings/ci_cd_controller.rb
app/controllers/projects/settings/ci_cd_controller.rb
+0
-6
app/controllers/search_controller.rb
app/controllers/search_controller.rb
+0
-1
app/helpers/blob_helper.rb
app/helpers/blob_helper.rb
+6
-0
app/helpers/search_helper.rb
app/helpers/search_helper.rb
+0
-7
app/services/search_service.rb
app/services/search_service.rb
+0
-4
app/views/projects/settings/ci_cd/_badge.html.haml
app/views/projects/settings/ci_cd/_badge.html.haml
+3
-3
app/views/search/results/_issue.html.haml
app/views/search/results/_issue.html.haml
+3
-2
changelogs/unreleased/244427-bold-search-term-issues.yml
changelogs/unreleased/244427-bold-search-term-issues.yml
+0
-5
ee/lib/elastic/latest/application_class_proxy.rb
ee/lib/elastic/latest/application_class_proxy.rb
+1
-7
ee/lib/gitlab/elastic/search_results.rb
ee/lib/gitlab/elastic/search_results.rb
+0
-19
ee/lib/gitlab/elastic/snippet_search_results.rb
ee/lib/gitlab/elastic/snippet_search_results.rb
+0
-4
ee/spec/lib/gitlab/elastic/search_results_spec.rb
ee/spec/lib/gitlab/elastic/search_results_spec.rb
+11
-37
ee/spec/lib/gitlab/elastic/snippet_search_results_spec.rb
ee/spec/lib/gitlab/elastic/snippet_search_results_spec.rb
+0
-7
lib/gitlab/search_results.rb
lib/gitlab/search_results.rb
+0
-5
spec/features/projects/badges/list_spec.rb
spec/features/projects/badges/list_spec.rb
+4
-4
spec/helpers/blob_helper_spec.rb
spec/helpers/blob_helper_spec.rb
+10
-0
spec/lib/gitlab/search_results_spec.rb
spec/lib/gitlab/search_results_spec.rb
+0
-19
spec/lib/gitlab/snippet_search_results_spec.rb
spec/lib/gitlab/snippet_search_results_spec.rb
+0
-6
No files found.
app/controllers/projects/settings/ci_cd_controller.rb
View file @
a8a42f0d
...
@@ -11,8 +11,6 @@ module Projects
...
@@ -11,8 +11,6 @@ module Projects
push_frontend_feature_flag
(
:ci_key_autocomplete
,
default_enabled:
true
)
push_frontend_feature_flag
(
:ci_key_autocomplete
,
default_enabled:
true
)
end
end
helper_method
:highlight_badge
def
show
def
show
end
end
...
@@ -52,10 +50,6 @@ module Projects
...
@@ -52,10 +50,6 @@ module Projects
private
private
def
highlight_badge
(
name
,
content
,
language
=
nil
)
Gitlab
::
Highlight
.
highlight
(
name
,
content
,
language:
language
)
end
def
update_params
def
update_params
params
.
require
(
:project
).
permit
(
*
permitted_project_params
)
params
.
require
(
:project
).
permit
(
*
permitted_project_params
)
end
end
...
...
app/controllers/search_controller.rb
View file @
a8a42f0d
...
@@ -38,7 +38,6 @@ class SearchController < ApplicationController
...
@@ -38,7 +38,6 @@ class SearchController < ApplicationController
@show_snippets
=
search_service
.
show_snippets?
@show_snippets
=
search_service
.
show_snippets?
@search_results
=
search_service
.
search_results
@search_results
=
search_service
.
search_results
@search_objects
=
search_service
.
search_objects
(
preload_method
)
@search_objects
=
search_service
.
search_objects
(
preload_method
)
@search_highlight
=
search_service
.
search_highlight
render_commits
if
@scope
==
'commits'
render_commits
if
@scope
==
'commits'
eager_load_user_status
if
@scope
==
'users'
eager_load_user_status
if
@scope
==
'users'
...
...
app/helpers/blob_helper.rb
View file @
a8a42f0d
# frozen_string_literal: true
# frozen_string_literal: true
module
BlobHelper
module
BlobHelper
def
highlight
(
file_name
,
file_content
,
language:
nil
,
plain:
false
)
highlighted
=
Gitlab
::
Highlight
.
highlight
(
file_name
,
file_content
,
plain:
plain
,
language:
language
)
raw
%(<pre class="code highlight"><code>#{highlighted}</code></pre>)
end
def
no_highlight_files
def
no_highlight_files
%w(credits changelog news copying copyright license authors)
%w(credits changelog news copying copyright license authors)
end
end
...
...
app/helpers/search_helper.rb
View file @
a8a42f0d
...
@@ -299,13 +299,6 @@ module SearchHelper
...
@@ -299,13 +299,6 @@ module SearchHelper
simple_search_highlight_and_truncate
(
issue
.
description
,
search_term
,
highlighter:
'<span class="gl-text-black-normal gl-font-weight-bold">\1</span>'
)
simple_search_highlight_and_truncate
(
issue
.
description
,
search_term
,
highlighter:
'<span class="gl-text-black-normal gl-font-weight-bold">\1</span>'
)
end
end
def
simple_search_highlight_and_truncate
(
text
,
phrase
,
options
=
{})
truncate_length
=
options
.
delete
(
:length
)
{
200
}
text
=
truncate
(
text
,
length:
truncate_length
)
phrase
=
phrase
.
split
highlight
(
text
,
phrase
,
options
)
end
def
show_user_search_tab?
def
show_user_search_tab?
return
false
if
Feature
.
disabled?
(
:users_search
,
default_enabled:
true
)
return
false
if
Feature
.
disabled?
(
:users_search
,
default_enabled:
true
)
...
...
app/services/search_service.rb
View file @
a8a42f0d
...
@@ -65,10 +65,6 @@ class SearchService
...
@@ -65,10 +65,6 @@ class SearchService
@search_objects
||=
redact_unauthorized_results
(
search_results
.
objects
(
scope
,
page:
params
[
:page
],
per_page:
per_page
,
preload_method:
preload_method
))
@search_objects
||=
redact_unauthorized_results
(
search_results
.
objects
(
scope
,
page:
params
[
:page
],
per_page:
per_page
,
preload_method:
preload_method
))
end
end
def
search_highlight
search_results
.
highlight_map
(
scope
)
end
private
private
def
per_page
def
per_page
...
...
app/views/projects/settings/ci_cd/_badge.html.haml
View file @
a8a42f0d
...
@@ -15,18 +15,18 @@
...
@@ -15,18 +15,18 @@
.col-md-2.text-center
.col-md-2.text-center
Markdown
Markdown
.col-md-10.code.js-syntax-highlight
.col-md-10.code.js-syntax-highlight
=
highlight
_badge
(
'.md'
,
badge
.
to_markdown
,
language:
'markdown'
)
=
highlight
(
'.md'
,
badge
.
to_markdown
,
language:
'markdown'
)
.row
.row
%hr
%hr
.row
.row
.col-md-2.text-center
.col-md-2.text-center
HTML
HTML
.col-md-10.code.js-syntax-highlight
.col-md-10.code.js-syntax-highlight
=
highlight
_badge
(
'.html'
,
badge
.
to_html
,
language:
'html'
)
=
highlight
(
'.html'
,
badge
.
to_html
,
language:
'html'
)
.row
.row
%hr
%hr
.row
.row
.col-md-2.text-center
.col-md-2.text-center
AsciiDoc
AsciiDoc
.col-md-10.code.js-syntax-highlight
.col-md-10.code.js-syntax-highlight
=
highlight
_badge
(
'.adoc'
,
badge
.
to_asciidoc
)
=
highlight
(
'.adoc'
,
badge
.
to_asciidoc
)
app/views/search/results/_issue.html.haml
View file @
a8a42f0d
...
@@ -9,5 +9,6 @@
...
@@ -9,5 +9,6 @@
%span
.term.str-truncated.gl-font-weight-bold.gl-ml-2
=
issue
.
title
%span
.term.str-truncated.gl-font-weight-bold.gl-ml-2
=
issue
.
title
.gl-text-gray-500.gl-my-3
.gl-text-gray-500.gl-my-3
=
sprintf
(
s_
(
' %{project_name}#%{issue_iid} · opened %{issue_created} by %{author}'
),
{
project_name:
issue
.
project
.
full_name
,
issue_iid:
issue
.
iid
,
issue_created:
time_ago_with_tooltip
(
issue
.
created_at
,
placement:
'bottom'
),
author:
link_to_member
(
@project
,
issue
.
author
,
avatar:
false
)
}).
html_safe
=
sprintf
(
s_
(
' %{project_name}#%{issue_iid} · opened %{issue_created} by %{author}'
),
{
project_name:
issue
.
project
.
full_name
,
issue_iid:
issue
.
iid
,
issue_created:
time_ago_with_tooltip
(
issue
.
created_at
,
placement:
'bottom'
),
author:
link_to_member
(
@project
,
issue
.
author
,
avatar:
false
)
}).
html_safe
-
if
issue
.
description
.
present?
.description.term.col-sm-10.gl-px-0
.description.term.col-sm-10.gl-px-0
=
highlight_and_truncate_issue
(
issue
,
@search_term
,
@search_highlight
)
=
truncate
(
issue
.
description
,
length:
200
)
changelogs/unreleased/244427-bold-search-term-issues.yml
deleted
100644 → 0
View file @
db820ba2
---
title
:
Global Search - Bold Issue's Search Term
merge_request
:
41411
author
:
type
:
changed
ee/lib/elastic/latest/application_class_proxy.rb
View file @
a8a42f0d
...
@@ -44,13 +44,7 @@ module Elastic
...
@@ -44,13 +44,7 @@ module Elastic
memo
[
field
.
to_sym
]
=
{}
memo
[
field
.
to_sym
]
=
{}
end
end
# Adding number_of_fragments: 0 to not split results into snippets. This way controllers can decide how to handle the highlighted data.
{
fields:
es_fields
}
{
fields:
es_fields
,
number_of_fragments:
0
,
pre_tags:
[
'<span class="gl-text-black-normal gl-font-weight-bold">'
],
post_tags:
[
'</span>'
]
}
end
end
def
basic_query_hash
(
fields
,
query
)
def
basic_query_hash
(
fields
,
query
)
...
...
ee/lib/gitlab/elastic/search_results.rb
View file @
a8a42f0d
...
@@ -46,25 +46,6 @@ module Gitlab
...
@@ -46,25 +46,6 @@ module Gitlab
end
end
end
end
# Pull the highlight attribute out of Elasticsearch results
# and map it to the result id
def
highlight_map
(
scope
)
results
=
case
scope
when
'projects'
projects
when
'issues'
issues
when
'merge_requests'
merge_requests
when
'milestones'
milestones
when
'notes'
notes
end
results
.
to_h
{
|
x
|
[
x
[
:_source
][
:id
],
x
[
:highlight
]]
}
if
results
.
present?
end
def
formatted_count
(
scope
)
def
formatted_count
(
scope
)
case
scope
case
scope
when
'projects'
when
'projects'
...
...
ee/lib/gitlab/elastic/snippet_search_results.rb
View file @
a8a42f0d
...
@@ -16,10 +16,6 @@ module Gitlab
...
@@ -16,10 +16,6 @@ module Gitlab
limited_snippet_titles_count
limited_snippet_titles_count
end
end
def
highlight_map
(
scope
)
snippet_titles
.
to_h
{
|
x
|
[
x
[
:_source
][
:id
],
x
[
:highlight
]]
}
end
private
private
def
snippet_titles
def
snippet_titles
...
...
ee/spec/lib/gitlab/elastic/search_results_spec.rb
View file @
a8a42f0d
...
@@ -12,32 +12,6 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
...
@@ -12,32 +12,6 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
let
(
:project_2
)
{
create
(
:project
,
:public
,
:repository
,
:wiki_repo
)
}
let
(
:project_2
)
{
create
(
:project
,
:public
,
:repository
,
:wiki_repo
)
}
let
(
:limit_project_ids
)
{
[
project_1
.
id
]
}
let
(
:limit_project_ids
)
{
[
project_1
.
id
]
}
describe
'#highlight_map'
do
using
RSpec
::
Parameterized
::
TableSyntax
let
(
:results
)
{
described_class
.
new
(
user
,
'hello world'
,
limit_project_ids
)
}
where
(
:scope
,
:results_method
,
:expected
)
do
'projects'
|
:projects
|
{
1
=>
'test <span class="gl-text-black-normal gl-font-weight-bold">highlight</span>'
}
'milestones'
|
:milestones
|
{
1
=>
'test <span class="gl-text-black-normal gl-font-weight-bold">highlight</span>'
}
'notes'
|
:notes
|
{
1
=>
'test <span class="gl-text-black-normal gl-font-weight-bold">highlight</span>'
}
'issues'
|
:issues
|
{
1
=>
'test <span class="gl-text-black-normal gl-font-weight-bold">highlight</span>'
}
'merge_requests'
|
:merge_requests
|
{
1
=>
'test <span class="gl-text-black-normal gl-font-weight-bold">highlight</span>'
}
'blobs'
|
nil
|
nil
'wiki_blobs'
|
nil
|
nil
'commits'
|
nil
|
nil
'users'
|
nil
|
nil
'unknown'
|
nil
|
nil
end
with_them
do
it
'returns the expected highlight map'
do
expect
(
results
).
to
receive
(
results_method
).
and_return
([{
_source:
{
id:
1
},
highlight:
'test <span class="gl-text-black-normal gl-font-weight-bold">highlight</span>'
}])
if
results_method
expect
(
results
.
highlight_map
(
scope
)).
to
eq
(
expected
)
end
end
end
describe
'#formatted_count'
do
describe
'#formatted_count'
do
using
RSpec
::
Parameterized
::
TableSyntax
using
RSpec
::
Parameterized
::
TableSyntax
...
@@ -568,7 +542,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
...
@@ -568,7 +542,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
end
end
end
end
describe
'
b
lobs'
do
describe
'
B
lobs'
do
before
do
before
do
project_1
.
repository
.
index_commits_and_blobs
project_1
.
repository
.
index_commits_and_blobs
...
@@ -778,7 +752,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
...
@@ -778,7 +752,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
end
end
end
end
describe
'
w
ikis'
do
describe
'
W
ikis'
do
let
(
:results
)
{
described_class
.
new
(
user
,
'term'
,
limit_project_ids
)
}
let
(
:results
)
{
described_class
.
new
(
user
,
'term'
,
limit_project_ids
)
}
subject
(
:wiki_blobs
)
{
results
.
objects
(
'wiki_blobs'
)
}
subject
(
:wiki_blobs
)
{
results
.
objects
(
'wiki_blobs'
)
}
...
@@ -865,7 +839,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
...
@@ -865,7 +839,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
end
end
end
end
describe
'
c
ommits'
do
describe
'
C
ommits'
do
before
do
before
do
project_1
.
repository
.
index_commits_and_blobs
project_1
.
repository
.
index_commits_and_blobs
ensure_elasticsearch_index!
ensure_elasticsearch_index!
...
@@ -901,7 +875,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
...
@@ -901,7 +875,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
end
end
end
end
describe
'
v
isibility levels'
do
describe
'
V
isibility levels'
do
let
(
:internal_project
)
{
create
(
:project
,
:internal
,
:repository
,
:wiki_repo
,
description:
"Internal project"
)
}
let
(
:internal_project
)
{
create
(
:project
,
:internal
,
:repository
,
:wiki_repo
,
description:
"Internal project"
)
}
let
(
:private_project1
)
{
create
(
:project
,
:private
,
:repository
,
:wiki_repo
,
description:
"Private project"
)
}
let
(
:private_project1
)
{
create
(
:project
,
:private
,
:repository
,
:wiki_repo
,
description:
"Private project"
)
}
let
(
:private_project2
)
{
create
(
:project
,
:private
,
:repository
,
:wiki_repo
,
description:
"Private project where I'm a member"
)
}
let
(
:private_project2
)
{
create
(
:project
,
:private
,
:repository
,
:wiki_repo
,
description:
"Private project where I'm a member"
)
}
...
@@ -912,7 +886,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
...
@@ -912,7 +886,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
private_project2
.
project_members
.
create
(
user:
user
,
access_level:
ProjectMember
::
DEVELOPER
)
private_project2
.
project_members
.
create
(
user:
user
,
access_level:
ProjectMember
::
DEVELOPER
)
end
end
context
'
i
ssues'
do
context
'
I
ssues'
do
it
'finds right set of issues'
do
it
'finds right set of issues'
do
issue_1
=
create
:issue
,
project:
internal_project
,
title:
"Internal project"
issue_1
=
create
:issue
,
project:
internal_project
,
title:
"Internal project"
create
:issue
,
project:
private_project1
,
title:
"Private project"
create
:issue
,
project:
private_project1
,
title:
"Private project"
...
@@ -939,7 +913,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
...
@@ -939,7 +913,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
end
end
end
end
context
'
m
ilestones'
do
context
'
M
ilestones'
do
let!
(
:milestone_1
)
{
create
(
:milestone
,
project:
internal_project
,
title:
"Internal project"
)
}
let!
(
:milestone_1
)
{
create
(
:milestone
,
project:
internal_project
,
title:
"Internal project"
)
}
let!
(
:milestone_2
)
{
create
(
:milestone
,
project:
private_project1
,
title:
"Private project"
)
}
let!
(
:milestone_2
)
{
create
(
:milestone
,
project:
private_project1
,
title:
"Private project"
)
}
let!
(
:milestone_3
)
{
create
(
:milestone
,
project:
private_project2
,
title:
"Private project which user is member"
)
}
let!
(
:milestone_3
)
{
create
(
:milestone
,
project:
private_project2
,
title:
"Private project which user is member"
)
}
...
@@ -1059,7 +1033,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
...
@@ -1059,7 +1033,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
end
end
end
end
context
'
p
rojects'
do
context
'
P
rojects'
do
it_behaves_like
'a paginated object'
,
'projects'
it_behaves_like
'a paginated object'
,
'projects'
it
'finds right set of projects'
do
it
'finds right set of projects'
do
...
@@ -1088,7 +1062,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
...
@@ -1088,7 +1062,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
end
end
end
end
context
'
merge r
equests'
do
context
'
Merge R
equests'
do
it
'finds right set of merge requests'
do
it
'finds right set of merge requests'
do
merge_request_1
=
create
:merge_request
,
target_project:
internal_project
,
source_project:
internal_project
,
title:
"Internal project"
merge_request_1
=
create
:merge_request
,
target_project:
internal_project
,
source_project:
internal_project
,
title:
"Internal project"
create
:merge_request
,
target_project:
private_project1
,
source_project:
private_project1
,
title:
"Private project"
create
:merge_request
,
target_project:
private_project1
,
source_project:
private_project1
,
title:
"Private project"
...
@@ -1115,7 +1089,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
...
@@ -1115,7 +1089,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
end
end
end
end
context
'
w
ikis'
do
context
'
W
ikis'
do
before
do
before
do
[
public_project
,
internal_project
,
private_project1
,
private_project2
].
each
do
|
project
|
[
public_project
,
internal_project
,
private_project1
,
private_project2
].
each
do
|
project
|
project
.
wiki
.
create_page
(
'index_page'
,
'term'
)
project
.
wiki
.
create_page
(
'index_page'
,
'term'
)
...
@@ -1142,7 +1116,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
...
@@ -1142,7 +1116,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
end
end
end
end
context
'
c
ommits'
do
context
'
C
ommits'
do
it
'finds right set of commits'
do
it
'finds right set of commits'
do
[
internal_project
,
private_project1
,
private_project2
,
public_project
].
each
do
|
project
|
[
internal_project
,
private_project1
,
private_project2
,
public_project
].
each
do
|
project
|
project
.
repository
.
create_file
(
project
.
repository
.
create_file
(
...
@@ -1174,7 +1148,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
...
@@ -1174,7 +1148,7 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
end
end
end
end
context
'
b
lobs'
do
context
'
B
lobs'
do
it
'finds right set of blobs'
do
it
'finds right set of blobs'
do
[
internal_project
,
private_project1
,
private_project2
,
public_project
].
each
do
|
project
|
[
internal_project
,
private_project1
,
private_project2
,
public_project
].
each
do
|
project
|
project
.
repository
.
create_file
(
project
.
repository
.
create_file
(
...
...
ee/spec/lib/gitlab/elastic/snippet_search_results_spec.rb
View file @
a8a42f0d
...
@@ -40,13 +40,6 @@ RSpec.describe Gitlab::Elastic::SnippetSearchResults, :elastic, :sidekiq_might_n
...
@@ -40,13 +40,6 @@ RSpec.describe Gitlab::Elastic::SnippetSearchResults, :elastic, :sidekiq_might_n
end
end
end
end
describe
'#highlight_map'
do
it
'returns the expected highlight map'
do
expect
(
results
).
to
receive
(
:snippet_titles
).
and_return
([{
_source:
{
id:
1
},
highlight:
'test <span class="gl-text-black-normal gl-font-weight-bold">highlight</span>'
}])
expect
(
results
.
highlight_map
(
'snippet_titles'
)).
to
eq
({
1
=>
'test <span class="gl-text-black-normal gl-font-weight-bold">highlight</span>'
})
end
end
context
'when user is not author'
do
context
'when user is not author'
do
let
(
:results
)
{
described_class
.
new
(
create
(
:user
),
'foo'
,
[])
}
let
(
:results
)
{
described_class
.
new
(
create
(
:user
),
'foo'
,
[])
}
...
...
lib/gitlab/search_results.rb
View file @
a8a42f0d
...
@@ -116,11 +116,6 @@ module Gitlab
...
@@ -116,11 +116,6 @@ module Gitlab
UsersFinder
.
new
(
current_user
,
search:
query
).
execute
UsersFinder
.
new
(
current_user
,
search:
query
).
execute
end
end
# highlighting is only performed by Elasticsearch backed results
def
highlight_map
(
scope
)
{}
end
private
private
def
projects
def
projects
...
...
spec/features/projects/badges/list_spec.rb
View file @
a8a42f0d
...
@@ -17,10 +17,10 @@ RSpec.describe 'list of badges' do
...
@@ -17,10 +17,10 @@ RSpec.describe 'list of badges' do
expect
(
page
).
to
have_content
'Markdown'
expect
(
page
).
to
have_content
'Markdown'
expect
(
page
).
to
have_content
'HTML'
expect
(
page
).
to
have_content
'HTML'
expect
(
page
).
to
have_content
'AsciiDoc'
expect
(
page
).
to
have_content
'AsciiDoc'
expect
(
page
).
to
have_css
(
'.
js-syntax-
highlight'
,
count:
3
)
expect
(
page
).
to
have_css
(
'.highlight'
,
count:
3
)
expect
(
page
).
to
have_xpath
(
"//img[@alt='pipeline status']"
)
expect
(
page
).
to
have_xpath
(
"//img[@alt='pipeline status']"
)
page
.
within
(
'.
js-syntax-
highlight'
,
match: :first
)
do
page
.
within
(
'.highlight'
,
match: :first
)
do
expect
(
page
).
to
have_content
'badges/master/pipeline.svg'
expect
(
page
).
to
have_content
'badges/master/pipeline.svg'
end
end
end
end
...
@@ -32,10 +32,10 @@ RSpec.describe 'list of badges' do
...
@@ -32,10 +32,10 @@ RSpec.describe 'list of badges' do
expect
(
page
).
to
have_content
'Markdown'
expect
(
page
).
to
have_content
'Markdown'
expect
(
page
).
to
have_content
'HTML'
expect
(
page
).
to
have_content
'HTML'
expect
(
page
).
to
have_content
'AsciiDoc'
expect
(
page
).
to
have_content
'AsciiDoc'
expect
(
page
).
to
have_css
(
'.
js-syntax-
highlight'
,
count:
3
)
expect
(
page
).
to
have_css
(
'.highlight'
,
count:
3
)
expect
(
page
).
to
have_xpath
(
"//img[@alt='coverage report']"
)
expect
(
page
).
to
have_xpath
(
"//img[@alt='coverage report']"
)
page
.
within
(
'.
js-syntax-
highlight'
,
match: :first
)
do
page
.
within
(
'.highlight'
,
match: :first
)
do
expect
(
page
).
to
have_content
'badges/master/coverage.svg'
expect
(
page
).
to
have_content
'badges/master/coverage.svg'
end
end
end
end
...
...
spec/helpers/blob_helper_spec.rb
View file @
a8a42f0d
...
@@ -5,6 +5,16 @@ require 'spec_helper'
...
@@ -5,6 +5,16 @@ require 'spec_helper'
RSpec
.
describe
BlobHelper
do
RSpec
.
describe
BlobHelper
do
include
TreeHelper
include
TreeHelper
describe
'#highlight'
do
it
'wraps highlighted content'
do
expect
(
helper
.
highlight
(
'test.rb'
,
'52'
)).
to
eq
(
%q[<pre class="code highlight"><code><span id="LC1" class="line" lang="ruby"><span class="mi">52</span></span></code></pre>]
)
end
it
'handles plain version'
do
expect
(
helper
.
highlight
(
'test.rb'
,
'52'
,
plain:
true
)).
to
eq
(
%q[<pre class="code highlight"><code><span id="LC1" class="line" lang="">52</span></code></pre>]
)
end
end
describe
"#sanitize_svg_data"
do
describe
"#sanitize_svg_data"
do
let
(
:input_svg_path
)
{
File
.
join
(
Rails
.
root
,
'spec'
,
'fixtures'
,
'unsanitized.svg'
)
}
let
(
:input_svg_path
)
{
File
.
join
(
Rails
.
root
,
'spec'
,
'fixtures'
,
'unsanitized.svg'
)
}
let
(
:data
)
{
File
.
read
(
input_svg_path
)
}
let
(
:data
)
{
File
.
read
(
input_svg_path
)
}
...
...
spec/lib/gitlab/search_results_spec.rb
View file @
a8a42f0d
...
@@ -58,25 +58,6 @@ RSpec.describe Gitlab::SearchResults do
...
@@ -58,25 +58,6 @@ RSpec.describe Gitlab::SearchResults do
end
end
end
end
describe
'#highlight_map'
do
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:scope
,
:expected
)
do
'projects'
|
{}
'issues'
|
{}
'merge_requests'
|
{}
'milestones'
|
{}
'users'
|
{}
'unknown'
|
{}
end
with_them
do
it
'returns the expected highlight_map'
do
expect
(
results
.
highlight_map
(
scope
)).
to
eq
(
expected
)
end
end
end
describe
'#formatted_limited_count'
do
describe
'#formatted_limited_count'
do
using
RSpec
::
Parameterized
::
TableSyntax
using
RSpec
::
Parameterized
::
TableSyntax
...
...
spec/lib/gitlab/snippet_search_results_spec.rb
View file @
a8a42f0d
...
@@ -21,12 +21,6 @@ RSpec.describe Gitlab::SnippetSearchResults do
...
@@ -21,12 +21,6 @@ RSpec.describe Gitlab::SnippetSearchResults do
end
end
end
end
describe
'#highlight_map'
do
it
'returns the expected highlight map'
do
expect
(
results
.
highlight_map
(
'snippet_titles'
)).
to
eq
({})
end
end
describe
'#objects'
do
describe
'#objects'
do
it
'uses page and per_page to paginate results'
do
it
'uses page and per_page to paginate results'
do
snippet2
=
create
(
:snippet
,
:public
,
content:
'foo'
,
file_name:
'foo'
)
snippet2
=
create
(
:snippet
,
:public
,
content:
'foo'
,
file_name:
'foo'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment