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
fcab4df1
Commit
fcab4df1
authored
May 08, 2020
by
Changzheng Liu
Committed by
Dmytro Zaporozhets
May 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove some spec
Update spec
parent
d6a1384d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
1 deletion
+29
-1
changelogs/unreleased/cl-wiki-result.yml
changelogs/unreleased/cl-wiki-result.yml
+5
-0
lib/gitlab/project_search_results.rb
lib/gitlab/project_search_results.rb
+8
-1
spec/lib/gitlab/project_search_results_spec.rb
spec/lib/gitlab/project_search_results_spec.rb
+16
-0
No files found.
changelogs/unreleased/cl-wiki-result.yml
0 → 100644
View file @
fcab4df1
---
title
:
Wrap wiki blob search result in its own object
merge_request
:
31155
author
:
type
:
fixed
lib/gitlab/project_search_results.rb
View file @
fcab4df1
...
...
@@ -18,7 +18,7 @@ module Gitlab
when
'blobs'
paginated_blobs
(
blobs
(
limit:
limit_up_to_page
(
page
,
per_page
)),
page
,
per_page
)
when
'wiki_blobs'
paginated_blobs
(
wiki_blobs
(
limit:
limit_up_to_page
(
page
,
per_page
)),
page
,
per_page
)
paginated_
wiki_
blobs
(
wiki_blobs
(
limit:
limit_up_to_page
(
page
,
per_page
)),
page
,
per_page
)
when
'commits'
Kaminari
.
paginate_array
(
commits
).
page
(
page
).
per
(
per_page
)
when
'users'
...
...
@@ -94,6 +94,13 @@ module Gitlab
results
end
def
paginated_wiki_blobs
(
blobs
,
page
,
per_page
)
blob_array
=
paginated_blobs
(
blobs
,
page
,
per_page
)
blob_array
.
map!
do
|
blob
|
Gitlab
::
Search
::
FoundWikiPage
.
new
(
blob
)
end
end
def
limit_up_to_page
(
page
,
per_page
)
current_page
=
page
&
.
to_i
||
1
offset
=
per_page
*
(
current_page
-
1
)
...
...
spec/lib/gitlab/project_search_results_spec.rb
View file @
fcab4df1
...
...
@@ -225,6 +225,22 @@ describe Gitlab::ProjectSearchResults do
end
it_behaves_like
'blob search pagination'
,
'wiki_blobs'
context
'return type'
do
let
(
:blobs
)
{
[
Gitlab
::
Search
::
FoundBlob
.
new
(
project:
project
)]
}
let
(
:results
)
{
described_class
.
new
(
user
,
project
,
"Files"
,
per_page:
20
)
}
before
do
allow
(
results
).
to
receive
(
:wiki_blobs
).
and_return
(
blobs
)
end
it
'returns list of FoundWikiPage type object'
do
objects
=
results
.
objects
(
'wiki_blobs'
)
expect
(
objects
).
to
be_present
expect
(
objects
).
to
all
(
be_a
(
Gitlab
::
Search
::
FoundWikiPage
))
end
end
end
it
'does not list issues on private projects'
do
...
...
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