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
Kazuhiko Shiozaki
gitlab-ce
Commits
ff3b68ac
Commit
ff3b68ac
authored
Jul 12, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
parents
98c3f446
d3d1e9ef
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
178 additions
and
30 deletions
+178
-30
CHANGELOG
CHANGELOG
+3
-2
app/assets/javascripts/dropzone_input.js.coffee
app/assets/javascripts/dropzone_input.js.coffee
+3
-3
app/controllers/autocomplete_controller.rb
app/controllers/autocomplete_controller.rb
+25
-12
app/models/repository.rb
app/models/repository.rb
+34
-0
app/views/search/results/_blob.html.haml
app/views/search/results/_blob.html.haml
+1
-0
app/views/search/results/_wiki_blob.html.haml
app/views/search/results/_wiki_blob.html.haml
+1
-0
docker/README.md
docker/README.md
+5
-3
spec/controllers/autocomplete_controller_spec.rb
spec/controllers/autocomplete_controller_spec.rb
+82
-10
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+24
-0
No files found.
CHANGELOG
View file @
ff3b68ac
Please view this file on the master branch, on stable branches it's out of date.
v 7.13.0 (unreleased)
- Fix user autocomplete for unauthenticated users accessing public projects (Stan Hu)
- Fix redirection to home page URL for unauthorized users (Daniel Gerhardt)
- Add branch switching support for graphs (Daniel Gerhardt)
- Fix external issue tracker hook/test for HTTPS URLs (Daniel Gerhardt)
- Remove link leading to a 404 error in Deploy Keys page (Stan Hu)
- Add support for unlocking users in admin settings (Stan Hu)
- Add Irker service configuration options (Stan Hu)
- Fix order of issues imported f
or
m GitHub (Hiroyuki Sato)
- Fix order of issues imported f
ro
m GitHub (Hiroyuki Sato)
- Bump rugments to 1.0.0beta8 to fix C prototype function highlighting (Jonathon Reinhart)
- Fix Merge Request webhook to properly fire "merge" action when accepted from the web UI
- Add `two_factor_enabled` field to admin user API (Stan Hu)
- Fix invalid timestamps in RSS feeds (Rowan Wookey)
- Fix error when deleting a user who has projects (Stan Hu)
- Fix downloading of patches on public merge requests when user logged out (Stan Hu)
- The password for the default administrator (root) account has been changed from "5iveL!fe" to "password".
- Fix Error 500 when relative submodule resolves to a namespace that has a different name from its path (Stan Hu)
...
...
@@ -43,6 +43,7 @@ v 7.13.0 (unreleased)
- Redesign project page. Show README as default instead of activity. Move project activity to separate page
- Make left menu more hierarchical and less contextual by adding back item at top
- A fork can’t have a visibility level that is greater than the original project.
- Faster code search in repository and wiki. Fixes search page timeout for big repositories
v 7.12.2
- Correctly show anonymous authorized applications under Profile > Applications.
...
...
app/assets/javascripts/dropzone_input.js.coffee
View file @
ff3b68ac
...
...
@@ -25,10 +25,10 @@ class @DropzoneInput
form_dropzone
=
$
(
form
).
find
(
'.div-dropzone'
)
form_dropzone
.
parent
().
addClass
"div-dropzone-wrapper"
form_dropzone
.
append
divHover
$
(
".div-dropzone-hover"
).
append
iconPaperclip
form_dropzone
.
find
(
".div-dropzone-hover"
).
append
iconPaperclip
form_dropzone
.
append
divSpinner
$
(
".div-dropzone-spinner"
).
append
iconSpinner
$
(
".div-dropzone-spinner"
).
css
form_dropzone
.
find
(
".div-dropzone-spinner"
).
append
iconSpinner
form_dropzone
.
find
(
".div-dropzone-spinner"
).
css
"opacity"
:
0
"display"
:
"none"
...
...
app/controllers/autocomplete_controller.rb
View file @
ff3b68ac
class
AutocompleteController
<
ApplicationController
skip_before_action
:authenticate_user!
,
only:
[
:users
]
def
users
begin
@users
=
if
params
[
:project_id
].
present?
project
=
Project
.
find
(
params
[
:project_id
])
...
...
@@ -13,10 +16,20 @@ class AutocompleteController < ApplicationController
if
can?
(
current_user
,
:read_group
,
group
)
group
.
users
end
else
elsif
current_user
User
.
all
end
rescue
ActiveRecord
::
RecordNotFound
if
current_user
return
render
json:
{},
status:
404
end
end
if
@users
.
nil?
&&
current_user
.
nil?
authenticate_user!
end
@users
||=
User
.
none
@users
=
@users
.
search
(
params
[
:search
])
if
params
[
:search
].
present?
@users
=
@users
.
active
@users
=
@users
.
page
(
params
[
:page
]).
per
(
PER_PAGE
)
...
...
app/models/repository.rb
View file @
ff3b68ac
...
...
@@ -431,6 +431,40 @@ class Repository
end
end
def
search_files
(
query
,
ref
)
offset
=
2
args
=
%W(git grep -i -n --before-context
#{
offset
}
--after-context
#{
offset
}
#{
query
}
#{
ref
||
root_ref
}
)
Gitlab
::
Popen
.
popen
(
args
,
path_to_repo
).
first
.
scrub
.
split
(
/^--$/
)
end
def
parse_search_result
(
result
)
ref
=
nil
filename
=
nil
startline
=
0
lines
=
result
.
lines
lines
.
each_with_index
do
|
line
,
index
|
if
line
=~
/^.*:.*:\d+:/
ref
,
filename
,
startline
=
line
.
split
(
':'
)
startline
=
startline
.
to_i
-
index
break
end
end
data
=
lines
.
map
do
|
line
|
line
.
sub
(
ref
,
''
).
sub
(
filename
,
''
).
sub
(
/^:-\d+-/
,
''
).
sub
(
/^::\d+:/
,
''
)
end
data
=
data
.
join
(
""
)
OpenStruct
.
new
(
filename:
filename
,
ref:
ref
,
startline:
startline
,
data:
data
)
end
private
def
cache
...
...
app/views/search/results/_blob.html.haml
View file @
ff3b68ac
-
blob
=
@project
.
repository
.
parse_search_result
(
blob
)
.blob-result
.file-holder
.file-title
...
...
app/views/search/results/_wiki_blob.html.haml
View file @
ff3b68ac
-
wiki_blob
=
@project
.
repository
.
parse_search_result
(
wiki_blob
)
.blob-result
.file-holder
.file-title
...
...
docker/README.md
View file @
ff3b68ac
...
...
@@ -163,3 +163,5 @@ sudo docker push gitlab/gitlab-ce:latest
## Troubleshooting
Please see the
[
troubleshooting
](
troubleshooting.md
)
file in this directory.
Note: We use
`fig.yml`
to have compatibility with fig and because docker-compose also supports it.
spec/controllers/autocomplete_controller_spec.rb
View file @
ff3b68ac
...
...
@@ -9,34 +9,58 @@ describe AutocompleteController do
before
do
sign_in
(
user
)
project
.
team
<<
[
user
,
:master
]
get
(
:users
,
project_id:
project
.
id
)
end
let
(
:body
)
{
JSON
.
parse
(
response
.
body
)
}
describe
'GET #users with project ID'
do
before
do
get
(
:users
,
project_id:
project
.
id
)
end
it
{
expect
(
body
).
to
be_kind_of
(
Array
)
}
it
{
expect
(
body
.
size
).
to
eq
1
}
it
{
expect
(
body
.
first
[
"username"
]).
to
eq
user
.
username
}
end
describe
'GET #users with unknown project'
do
before
do
get
(
:users
,
project_id:
'unknown'
)
end
it
{
expect
(
response
.
status
).
to
eq
(
404
)
}
end
end
context
'group members'
do
let
(
:group
)
{
create
(
:group
)
}
before
do
sign_in
(
user
)
group
.
add_owner
(
user
)
get
(
:users
,
group_id:
group
.
id
)
end
let
(
:body
)
{
JSON
.
parse
(
response
.
body
)
}
describe
'GET #users with group ID'
do
before
do
get
(
:users
,
group_id:
group
.
id
)
end
it
{
expect
(
body
).
to
be_kind_of
(
Array
)
}
it
{
expect
(
body
.
size
).
to
eq
1
}
it
{
expect
(
body
.
first
[
"username"
]).
to
eq
user
.
username
}
end
describe
'GET #users with unknown group ID'
do
before
do
get
(
:users
,
group_id:
'unknown'
)
end
it
{
expect
(
response
.
status
).
to
eq
(
404
)
}
end
end
context
'all users'
do
before
do
sign_in
(
user
)
...
...
@@ -48,4 +72,52 @@ describe AutocompleteController do
it
{
expect
(
body
).
to
be_kind_of
(
Array
)
}
it
{
expect
(
body
.
size
).
to
eq
User
.
count
}
end
context
'unauthenticated user'
do
let
(
:public_project
)
{
create
(
:project
,
:public
)
}
let
(
:body
)
{
JSON
.
parse
(
response
.
body
)
}
describe
'GET #users with public project'
do
before
do
public_project
.
team
<<
[
user
,
:guest
]
get
(
:users
,
project_id:
public_project
.
id
)
end
it
{
expect
(
body
).
to
be_kind_of
(
Array
)
}
it
{
expect
(
body
.
size
).
to
eq
1
}
end
describe
'GET #users with project'
do
before
do
get
(
:users
,
project_id:
project
.
id
)
end
it
{
expect
(
response
.
status
).
to
eq
(
302
)
}
end
describe
'GET #users with unknown project'
do
before
do
get
(
:users
,
project_id:
'unknown'
)
end
it
{
expect
(
response
.
status
).
to
eq
(
302
)
}
end
describe
'GET #users with inaccessible group'
do
before
do
project
.
team
<<
[
user
,
:guest
]
get
(
:users
,
group_id:
user
.
namespace
.
id
)
end
it
{
expect
(
response
.
status
).
to
eq
(
302
)
}
end
describe
'GET #users with no project'
do
before
do
get
(
:users
)
end
it
{
expect
(
response
.
status
).
to
eq
(
302
)
}
end
end
end
spec/models/repository_spec.rb
View file @
ff3b68ac
...
...
@@ -47,4 +47,28 @@ describe Repository do
it
{
is_expected
.
to
be_falsey
}
end
end
describe
"search_files"
do
let
(
:results
)
{
repository
.
search_files
(
'feature'
,
'master'
)
}
subject
{
results
}
it
{
is_expected
.
to
be_an
Array
}
describe
'result'
do
subject
{
results
.
first
}
it
{
is_expected
.
to
be_an
String
}
it
{
expect
(
subject
.
lines
[
2
]).
to
eq
(
"master:CHANGELOG:188: - Feature: Replace teams with group membership
\n
"
)
}
end
describe
'parsing result'
do
subject
{
repository
.
parse_search_result
(
results
.
first
)
}
it
{
is_expected
.
to
be_an
OpenStruct
}
it
{
expect
(
subject
.
filename
).
to
eq
(
'CHANGELOG'
)
}
it
{
expect
(
subject
.
ref
).
to
eq
(
'master'
)
}
it
{
expect
(
subject
.
startline
).
to
eq
(
186
)
}
it
{
expect
(
subject
.
data
.
lines
[
2
]).
to
eq
(
" - Feature: Replace teams with group membership
\n
"
)
}
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