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
99a34a52
Commit
99a34a52
authored
Feb 22, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable Style/MultilineArrayBraceLayout
parent
6023fbfd
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
133 additions
and
96 deletions
+133
-96
.rubocop.yml
.rubocop.yml
+2
-1
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+11
-9
lib/api/award_emoji.rb
lib/api/award_emoji.rb
+3
-2
lib/api/projects.rb
lib/api/projects.rb
+2
-1
lib/api/v3/projects.rb
lib/api/v3/projects.rb
+2
-1
lib/gitlab/sanitizers/svg/whitelist.rb
lib/gitlab/sanitizers/svg/whitelist.rb
+13
-12
spec/lib/gitlab/o_auth/user_spec.rb
spec/lib/gitlab/o_auth/user_spec.rb
+10
-6
spec/lib/gitlab/saml/user_spec.rb
spec/lib/gitlab/saml/user_spec.rb
+3
-6
spec/lib/gitlab/serializer/ci/variables_spec.rb
spec/lib/gitlab/serializer/ci/variables_spec.rb
+2
-1
spec/lib/gitlab/upgrader_spec.rb
spec/lib/gitlab/upgrader_spec.rb
+2
-1
spec/requests/lfs_http_spec.rb
spec/requests/lfs_http_spec.rb
+83
-56
No files found.
.rubocop.yml
View file @
99a34a52
...
...
@@ -204,6 +204,7 @@ Style/For:
# Checks if there is a magic comment to enforce string literals
Style/FrozenStringLiteralComment
:
Enabled
:
false
# Do not introduce global variables.
Style/GlobalVars
:
Enabled
:
true
...
...
@@ -262,7 +263,7 @@ Style/ModuleFunction:
# Checks that the closing brace in an array literal is either on the same line
# as the last array element, or a new line.
Style/MultilineArrayBraceLayout
:
Enabled
:
fals
e
Enabled
:
tru
e
EnforcedStyle
:
symmetrical
# Avoid multi-line chains of blocks.
...
...
config/initializers/1_settings.rb
View file @
99a34a52
...
...
@@ -20,11 +20,12 @@ class Settings < Settingslogic
else
":
#{
gitlab
.
port
}
"
end
[
gitlab
.
protocol
,
"://"
,
gitlab
.
host
,
custom_port
,
gitlab
.
relative_url_root
[
gitlab
.
protocol
,
"://"
,
gitlab
.
host
,
custom_port
,
gitlab
.
relative_url_root
].
join
(
''
)
end
...
...
@@ -81,10 +82,11 @@ class Settings < Settingslogic
def
base_url
(
config
)
custom_port
=
on_standard_port?
(
config
)
?
nil
:
":
#{
config
.
port
}
"
[
config
.
protocol
,
"://"
,
config
.
host
,
custom_port
[
config
.
protocol
,
"://"
,
config
.
host
,
custom_port
]
end
...
...
lib/api/award_emoji.rb
View file @
99a34a52
...
...
@@ -15,8 +15,9 @@ module API
requires
:"
#{
awardable_id_string
}
"
,
type:
Integer
,
desc:
"The ID of an Issue, Merge Request or Snippet"
end
[
":id/
#{
awardable_string
}
/:
#{
awardable_id_string
}
/award_emoji"
,
":id/
#{
awardable_string
}
/:
#{
awardable_id_string
}
/notes/:note_id/award_emoji"
[
":id/
#{
awardable_string
}
/:
#{
awardable_id_string
}
/award_emoji"
,
":id/
#{
awardable_string
}
/:
#{
awardable_id_string
}
/notes/:note_id/award_emoji"
].
each
do
|
endpoint
|
desc
'Get a list of project +awardable+ award emoji'
do
...
...
lib/api/projects.rb
View file @
99a34a52
...
...
@@ -19,7 +19,8 @@ module API
optional
:visibility_level
,
type:
Integer
,
values:
[
Gitlab
::
VisibilityLevel
::
PRIVATE
,
Gitlab
::
VisibilityLevel
::
INTERNAL
,
Gitlab
::
VisibilityLevel
::
PUBLIC
],
desc:
'Create a public project. The same as visibility_level = 20.'
Gitlab
::
VisibilityLevel
::
PUBLIC
],
desc:
'Create a public project. The same as visibility_level = 20.'
optional
:public_builds
,
type:
Boolean
,
desc:
'Perform public builds'
optional
:request_access_enabled
,
type:
Boolean
,
desc:
'Allow users to request member access'
optional
:only_allow_merge_if_build_succeeds
,
type:
Boolean
,
desc:
'Only allow to merge if builds succeed'
...
...
lib/api/v3/projects.rb
View file @
99a34a52
...
...
@@ -20,7 +20,8 @@ module API
optional
:visibility_level
,
type:
Integer
,
values:
[
Gitlab
::
VisibilityLevel
::
PRIVATE
,
Gitlab
::
VisibilityLevel
::
INTERNAL
,
Gitlab
::
VisibilityLevel
::
PUBLIC
],
desc:
'Create a public project. The same as visibility_level = 20.'
Gitlab
::
VisibilityLevel
::
PUBLIC
],
desc:
'Create a public project. The same as visibility_level = 20.'
optional
:public_builds
,
type:
Boolean
,
desc:
'Perform public builds'
optional
:request_access_enabled
,
type:
Boolean
,
desc:
'Allow users to request member access'
optional
:only_allow_merge_if_build_succeeds
,
type:
Boolean
,
desc:
'Only allow to merge if builds succeed'
...
...
lib/gitlab/sanitizers/svg/whitelist.rb
View file @
99a34a52
...
...
@@ -6,18 +6,19 @@ module Gitlab
module
SVG
class
Whitelist
ALLOWED_ELEMENTS
=
%w[
a altGlyph altGlyphDef altGlyphItem animate
animateColor animateMotion animateTransform circle clipPath color-profile
cursor defs desc ellipse feBlend feColorMatrix feComponentTransfer
feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap
feDistantLight feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur
feImage feMerge feMergeNode feMorphology feOffset fePointLight
feSpecularLighting feSpotLight feTile feTurbulence filter font font-face
font-face-format font-face-name font-face-src font-face-uri foreignObject
g glyph glyphRef hkern image line linearGradient marker mask metadata
missing-glyph mpath path pattern polygon polyline radialGradient rect
script set stop style svg switch symbol text textPath title tref tspan use
view vkern]
.
freeze
a altGlyph altGlyphDef altGlyphItem animate
animateColor animateMotion animateTransform circle clipPath color-profile
cursor defs desc ellipse feBlend feColorMatrix feComponentTransfer
feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap
feDistantLight feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur
feImage feMerge feMergeNode feMorphology feOffset fePointLight
feSpecularLighting feSpotLight feTile feTurbulence filter font font-face
font-face-format font-face-name font-face-src font-face-uri foreignObject
g glyph glyphRef hkern image line linearGradient marker mask metadata
missing-glyph mpath path pattern polygon polyline radialGradient rect
script set stop style svg switch symbol text textPath title tref tspan use
view vkern
]
.
freeze
ALLOWED_DATA_ATTRIBUTES_IN_ELEMENTS
=
%w[svg]
.
freeze
...
...
spec/lib/gitlab/o_auth/user_spec.rb
View file @
99a34a52
...
...
@@ -151,9 +151,11 @@ describe Gitlab::OAuth::User, lib: true do
expect
(
gl_user
.
identities
.
length
).
to
eql
2
identities_as_hash
=
gl_user
.
identities
.
map
{
|
id
|
{
provider:
id
.
provider
,
extern_uid:
id
.
extern_uid
}
}
expect
(
identities_as_hash
).
to
match_array
(
[{
provider:
'ldapmain'
,
extern_uid:
'uid=user1,ou=People,dc=example'
},
{
provider:
'twitter'
,
extern_uid:
uid
}
])
[
{
provider:
'ldapmain'
,
extern_uid:
'uid=user1,ou=People,dc=example'
},
{
provider:
'twitter'
,
extern_uid:
uid
}
]
)
end
end
...
...
@@ -170,9 +172,11 @@ describe Gitlab::OAuth::User, lib: true do
expect
(
gl_user
.
identities
.
length
).
to
eql
2
identities_as_hash
=
gl_user
.
identities
.
map
{
|
id
|
{
provider:
id
.
provider
,
extern_uid:
id
.
extern_uid
}
}
expect
(
identities_as_hash
).
to
match_array
(
[{
provider:
'ldapmain'
,
extern_uid:
'uid=user1,ou=People,dc=example'
},
{
provider:
'twitter'
,
extern_uid:
uid
}
])
[
{
provider:
'ldapmain'
,
extern_uid:
'uid=user1,ou=People,dc=example'
},
{
provider:
'twitter'
,
extern_uid:
uid
}
]
)
end
end
...
...
spec/lib/gitlab/saml/user_spec.rb
View file @
99a34a52
...
...
@@ -158,8 +158,7 @@ describe Gitlab::Saml::User, lib: true do
expect
(
gl_user
.
identities
.
length
).
to
eql
2
identities_as_hash
=
gl_user
.
identities
.
map
{
|
id
|
{
provider:
id
.
provider
,
extern_uid:
id
.
extern_uid
}
}
expect
(
identities_as_hash
).
to
match_array
([{
provider:
'ldapmain'
,
extern_uid:
'uid=user1,ou=People,dc=example'
},
{
provider:
'saml'
,
extern_uid:
uid
}
])
{
provider:
'saml'
,
extern_uid:
uid
}])
end
end
...
...
@@ -181,8 +180,7 @@ describe Gitlab::Saml::User, lib: true do
expect
(
gl_user
.
identities
.
length
).
to
eql
2
identities_as_hash
=
gl_user
.
identities
.
map
{
|
id
|
{
provider:
id
.
provider
,
extern_uid:
id
.
extern_uid
}
}
expect
(
identities_as_hash
).
to
match_array
([{
provider:
'ldapmain'
,
extern_uid:
'uid=user1,ou=People,dc=example'
},
{
provider:
'saml'
,
extern_uid:
uid
}
])
{
provider:
'saml'
,
extern_uid:
uid
}])
end
it
'saves successfully on subsequent tries, when both identities are present'
do
...
...
@@ -207,8 +205,7 @@ describe Gitlab::Saml::User, lib: true do
expect
(
local_gl_user
.
identities
.
length
).
to
eql
2
identities_as_hash
=
local_gl_user
.
identities
.
map
{
|
id
|
{
provider:
id
.
provider
,
extern_uid:
id
.
extern_uid
}
}
expect
(
identities_as_hash
).
to
match_array
([{
provider:
'ldapmain'
,
extern_uid:
'uid=user1,ou=People,dc=example'
},
{
provider:
'saml'
,
extern_uid:
'uid=user1,ou=People,dc=example'
}
])
{
provider:
'saml'
,
extern_uid:
'uid=user1,ou=People,dc=example'
}])
end
end
end
...
...
spec/lib/gitlab/serializer/ci/variables_spec.rb
View file @
99a34a52
...
...
@@ -13,6 +13,7 @@ describe Gitlab::Serializer::Ci::Variables do
it
'converts keys into strings'
do
is_expected
.
to
eq
([
{
key:
'key'
,
value:
'value'
,
public:
true
},
{
key:
'wee'
,
value:
1
,
public:
false
}])
{
key:
'wee'
,
value:
1
,
public:
false
}
])
end
end
spec/lib/gitlab/upgrader_spec.rb
View file @
99a34a52
...
...
@@ -32,7 +32,8 @@ describe Gitlab::Upgrader, lib: true do
'43af3e65a486a9237f29f56d96c3b3da59c24ae0 refs/tags/v7.11.2'
,
'dac18e7728013a77410e926a1e64225703754a2d refs/tags/v7.11.2^{}'
,
'0bf21fd4b46c980c26fd8c90a14b86a4d90cc950 refs/tags/v7.9.4'
,
'b10de29edbaff7219547dc506cb1468ee35065c3 refs/tags/v7.9.4^{}'
])
'b10de29edbaff7219547dc506cb1468ee35065c3 refs/tags/v7.9.4^{}'
])
expect
(
upgrader
.
latest_version_raw
).
to
eq
(
"v7.11.2"
)
end
end
...
...
spec/requests/lfs_http_spec.rb
View file @
99a34a52
...
...
@@ -374,11 +374,13 @@ describe 'Git LFS API and storage' do
describe
'download'
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:body
)
do
{
'operation'
=>
'download'
,
{
'operation'
=>
'download'
,
'objects'
=>
[
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
}]
}
]
}
end
...
...
@@ -393,16 +395,19 @@ describe 'Git LFS API and storage' do
end
it
'with href to download'
do
expect
(
json_response
).
to
eq
(
'objects'
=>
[
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
,
'actions'
=>
{
'download'
=>
{
'href'
=>
"
#{
project
.
http_url_to_repo
}
/gitlab-lfs/objects/
#{
sample_oid
}
"
,
'header'
=>
{
'Authorization'
=>
authorization
}
expect
(
json_response
).
to
eq
({
'objects'
=>
[
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
,
'actions'
=>
{
'download'
=>
{
'href'
=>
"
#{
project
.
http_url_to_repo
}
/gitlab-lfs/objects/
#{
sample_oid
}
"
,
'header'
=>
{
'Authorization'
=>
authorization
}
}
}
}
}])
]
})
end
end
...
...
@@ -417,24 +422,29 @@ describe 'Git LFS API and storage' do
end
it
'with href to download'
do
expect
(
json_response
).
to
eq
(
'objects'
=>
[
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
,
'error'
=>
{
'code'
=>
404
,
'message'
=>
"Object does not exist on the server or you don't have permissions to access it"
,
expect
(
json_response
).
to
eq
({
'objects'
=>
[
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
,
'error'
=>
{
'code'
=>
404
,
'message'
=>
"Object does not exist on the server or you don't have permissions to access it"
,
}
}
}])
]
})
end
end
context
'when downloading a lfs object that does not exist'
do
let
(
:body
)
do
{
'operation'
=>
'download'
,
{
'operation'
=>
'download'
,
'objects'
=>
[
{
'oid'
=>
'91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897'
,
'size'
=>
1575078
}]
}
]
}
end
...
...
@@ -443,14 +453,17 @@ describe 'Git LFS API and storage' do
end
it
'with an 404 for specific object'
do
expect
(
json_response
).
to
eq
(
'objects'
=>
[
{
'oid'
=>
'91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897'
,
'size'
=>
1575078
,
'error'
=>
{
'code'
=>
404
,
'message'
=>
"Object does not exist on the server or you don't have permissions to access it"
,
expect
(
json_response
).
to
eq
({
'objects'
=>
[
{
'oid'
=>
'91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897'
,
'size'
=>
1575078
,
'error'
=>
{
'code'
=>
404
,
'message'
=>
"Object does not exist on the server or you don't have permissions to access it"
,
}
}
}])
]
})
end
end
...
...
@@ -477,23 +490,28 @@ describe 'Git LFS API and storage' do
end
it
'responds with upload hypermedia link for the new object'
do
expect
(
json_response
).
to
eq
(
'objects'
=>
[
{
'oid'
=>
'91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897'
,
'size'
=>
1575078
,
'error'
=>
{
'code'
=>
404
,
'message'
=>
"Object does not exist on the server or you don't have permissions to access it"
,
}
},
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
,
'actions'
=>
{
'download'
=>
{
'href'
=>
"
#{
project
.
http_url_to_repo
}
/gitlab-lfs/objects/
#{
sample_oid
}
"
,
'header'
=>
{
'Authorization'
=>
authorization
}
expect
(
json_response
).
to
eq
({
'objects'
=>
[
{
'oid'
=>
'91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897'
,
'size'
=>
1575078
,
'error'
=>
{
'code'
=>
404
,
'message'
=>
"Object does not exist on the server or you don't have permissions to access it"
,
}
},
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
,
'actions'
=>
{
'download'
=>
{
'href'
=>
"
#{
project
.
http_url_to_repo
}
/gitlab-lfs/objects/
#{
sample_oid
}
"
,
'header'
=>
{
'Authorization'
=>
authorization
}
}
}
}
}])
]
})
end
end
end
...
...
@@ -597,17 +615,20 @@ describe 'Git LFS API and storage' do
end
it
'responds with status 200 and href to download'
do
expect
(
json_response
).
to
eq
(
'objects'
=>
[
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
,
'authenticated'
=>
true
,
'actions'
=>
{
'download'
=>
{
'href'
=>
"
#{
project
.
http_url_to_repo
}
/gitlab-lfs/objects/
#{
sample_oid
}
"
,
'header'
=>
{}
expect
(
json_response
).
to
eq
({
'objects'
=>
[
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
,
'authenticated'
=>
true
,
'actions'
=>
{
'download'
=>
{
'href'
=>
"
#{
project
.
http_url_to_repo
}
/gitlab-lfs/objects/
#{
sample_oid
}
"
,
'header'
=>
{}
}
}
}
}])
]
})
end
end
...
...
@@ -626,11 +647,13 @@ describe 'Git LFS API and storage' do
describe
'upload'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:body
)
do
{
'operation'
=>
'upload'
,
{
'operation'
=>
'upload'
,
'objects'
=>
[
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
}]
}
]
}
end
...
...
@@ -665,11 +688,13 @@ describe 'Git LFS API and storage' do
context
'when pushing a lfs object that does not exist'
do
let
(
:body
)
do
{
'operation'
=>
'upload'
,
{
'operation'
=>
'upload'
,
'objects'
=>
[
{
'oid'
=>
'91eff75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897'
,
'size'
=>
1575078
}]
}
]
}
end
...
...
@@ -789,11 +814,13 @@ describe 'Git LFS API and storage' do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:authorization
)
{
authorize_user
}
let
(
:body
)
do
{
'operation'
=>
'other'
,
{
'operation'
=>
'other'
,
'objects'
=>
[
{
'oid'
=>
sample_oid
,
'size'
=>
sample_size
}]
}
]
}
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