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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
f0b052e1
Commit
f0b052e1
authored
Mar 09, 2016
by
Hiroyuki Sato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix wiki search results point to raw source
parent
374037b8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
4 deletions
+25
-4
CHANGELOG
CHANGELOG
+1
-0
app/models/repository.rb
app/models/repository.rb
+4
-0
app/views/search/results/_wiki_blob.html.haml
app/views/search/results/_wiki_blob.html.haml
+2
-2
features/steps/search.rb
features/steps/search.rb
+1
-1
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+17
-1
No files found.
CHANGELOG
View file @
f0b052e1
...
@@ -11,6 +11,7 @@ v 8.6.0 (unreleased)
...
@@ -11,6 +11,7 @@ v 8.6.0 (unreleased)
GitLab will ask the user to create a new one upon first visit.
GitLab will ask the user to create a new one upon first visit.
- Fix issue when pushing to projects ending in .wiki
- Fix issue when pushing to projects ending in .wiki
- Add support for wiki with UTF-8 page names (Hiroyuki Sato)
- Add support for wiki with UTF-8 page names (Hiroyuki Sato)
- Fix wiki search results point to raw source (Hiroyuki Sato)
- Don't load all of GitLab in mail_room
- Don't load all of GitLab in mail_room
- Update `omniauth-saml` to 1.5.0 to allow for custom response attributes to be set
- Update `omniauth-saml` to 1.5.0 to allow for custom response attributes to be set
- Memoize @group in Admin::GroupsController (Yatish Mehta)
- Memoize @group in Admin::GroupsController (Yatish Mehta)
...
...
app/models/repository.rb
View file @
f0b052e1
...
@@ -758,12 +758,15 @@ class Repository
...
@@ -758,12 +758,15 @@ class Repository
def
parse_search_result
(
result
)
def
parse_search_result
(
result
)
ref
=
nil
ref
=
nil
filename
=
nil
filename
=
nil
basename
=
nil
startline
=
0
startline
=
0
result
.
each_line
.
each_with_index
do
|
line
,
index
|
result
.
each_line
.
each_with_index
do
|
line
,
index
|
if
line
=~
/^.*:.*:\d+:/
if
line
=~
/^.*:.*:\d+:/
ref
,
filename
,
startline
=
line
.
split
(
':'
)
ref
,
filename
,
startline
=
line
.
split
(
':'
)
startline
=
startline
.
to_i
-
index
startline
=
startline
.
to_i
-
index
extname
=
File
.
extname
(
filename
)
basename
=
filename
.
sub
(
/
#{
extname
}
$/
,
''
)
break
break
end
end
end
end
...
@@ -776,6 +779,7 @@ class Repository
...
@@ -776,6 +779,7 @@ class Repository
OpenStruct
.
new
(
OpenStruct
.
new
(
filename:
filename
,
filename:
filename
,
basename:
basename
,
ref:
ref
,
ref:
ref
,
startline:
startline
,
startline:
startline
,
data:
data
data:
data
...
...
app/views/search/results/_wiki_blob.html.haml
View file @
f0b052e1
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
.blob-result
.blob-result
.file-holder
.file-holder
.file-title
.file-title
=
link_to
namespace_project_wiki_path
(
@project
.
namespace
,
@project
,
wiki_blob
.
fil
ename
)
do
=
link_to
namespace_project_wiki_path
(
@project
.
namespace
,
@project
,
wiki_blob
.
bas
ename
)
do
%i
.fa.fa-file
%i
.fa.fa-file
%strong
%strong
=
wiki_blob
.
fil
ename
=
wiki_blob
.
bas
ename
.file-content.code.term
.file-content.code.term
=
render
'shared/file_highlight'
,
blob:
wiki_blob
,
first_line_number:
wiki_blob
.
startline
=
render
'shared/file_highlight'
,
blob:
wiki_blob
,
first_line_number:
wiki_blob
.
startline
features/steps/search.rb
View file @
f0b052e1
...
@@ -100,7 +100,7 @@ class Spinach::Features::Search < Spinach::FeatureSteps
...
@@ -100,7 +100,7 @@ class Spinach::Features::Search < Spinach::FeatureSteps
step
'I should see "test_wiki" link in the search results'
do
step
'I should see "test_wiki" link in the search results'
do
page
.
within
(
'.results'
)
do
page
.
within
(
'.results'
)
do
find
(
:css
,
'.search-results'
).
should
have_link
'test_wiki.md
'
expect
(
find
(
:css
,
'.search-results'
)).
to
have_link
'test_wiki
'
end
end
end
end
...
...
spec/models/repository_spec.rb
View file @
f0b052e1
...
@@ -101,13 +101,29 @@ describe Repository, models: true do
...
@@ -101,13 +101,29 @@ describe Repository, models: true do
end
end
describe
'parsing result'
do
describe
'parsing result'
do
subject
{
repository
.
parse_search_result
(
results
.
first
)
}
subject
{
repository
.
parse_search_result
(
search_result
)
}
let
(
:search_result
)
{
results
.
first
}
it
{
is_expected
.
to
be_an
OpenStruct
}
it
{
is_expected
.
to
be_an
OpenStruct
}
it
{
expect
(
subject
.
filename
).
to
eq
(
'CHANGELOG'
)
}
it
{
expect
(
subject
.
filename
).
to
eq
(
'CHANGELOG'
)
}
it
{
expect
(
subject
.
basename
).
to
eq
(
'CHANGELOG'
)
}
it
{
expect
(
subject
.
ref
).
to
eq
(
'master'
)
}
it
{
expect
(
subject
.
ref
).
to
eq
(
'master'
)
}
it
{
expect
(
subject
.
startline
).
to
eq
(
186
)
}
it
{
expect
(
subject
.
startline
).
to
eq
(
186
)
}
it
{
expect
(
subject
.
data
.
lines
[
2
]).
to
eq
(
" - Feature: Replace teams with group membership
\n
"
)
}
it
{
expect
(
subject
.
data
.
lines
[
2
]).
to
eq
(
" - Feature: Replace teams with group membership
\n
"
)
}
context
"when filename has extension"
do
let
(
:search_result
)
{
"master:CONTRIBUTE.md:5:- [Contribute to GitLab](#contribute-to-gitlab)
\n
"
}
it
{
expect
(
subject
.
filename
).
to
eq
(
'CONTRIBUTE.md'
)
}
it
{
expect
(
subject
.
basename
).
to
eq
(
'CONTRIBUTE'
)
}
end
context
"when file under directory"
do
let
(
:search_result
)
{
"master:a/b/c.md:5:a b c
\n
"
}
it
{
expect
(
subject
.
filename
).
to
eq
(
'a/b/c.md'
)
}
it
{
expect
(
subject
.
basename
).
to
eq
(
'a/b/c'
)
}
end
end
end
end
end
...
...
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