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
Boxiang Sun
gitlab-ce
Commits
72307940
Commit
72307940
authored
May 03, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve code style related to protected actions
parent
738bf2c2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
10 deletions
+8
-10
app/serializers/build_action_entity.rb
app/serializers/build_action_entity.rb
+1
-1
app/serializers/build_entity.rb
app/serializers/build_entity.rb
+2
-2
app/serializers/pipeline_entity.rb
app/serializers/pipeline_entity.rb
+3
-3
app/services/ci/play_build_service.rb
app/services/ci/play_build_service.rb
+1
-1
spec/controllers/projects/builds_controller_spec.rb
spec/controllers/projects/builds_controller_spec.rb
+1
-3
No files found.
app/serializers/build_action_entity.rb
View file @
72307940
...
@@ -19,6 +19,6 @@ class BuildActionEntity < Grape::Entity
...
@@ -19,6 +19,6 @@ class BuildActionEntity < Grape::Entity
alias_method
:build
,
:object
alias_method
:build
,
:object
def
playable?
def
playable?
can?
(
request
.
user
,
:play_build
,
build
)
&&
build
.
playable?
build
.
playable?
&&
can?
(
request
.
user
,
:play_build
,
build
)
end
end
end
end
app/serializers/build_entity.rb
View file @
72307940
...
@@ -12,7 +12,7 @@ class BuildEntity < Grape::Entity
...
@@ -12,7 +12,7 @@ class BuildEntity < Grape::Entity
path_to
(
:retry_namespace_project_build
,
build
)
path_to
(
:retry_namespace_project_build
,
build
)
end
end
expose
:play_path
,
if:
proc
{
playable?
}
do
|
build
|
expose
:play_path
,
if:
->
(
*
)
{
playable?
}
do
|
build
|
path_to
(
:play_namespace_project_build
,
build
)
path_to
(
:play_namespace_project_build
,
build
)
end
end
...
@@ -26,7 +26,7 @@ class BuildEntity < Grape::Entity
...
@@ -26,7 +26,7 @@ class BuildEntity < Grape::Entity
alias_method
:build
,
:object
alias_method
:build
,
:object
def
playable?
def
playable?
can?
(
request
.
user
,
:play_build
,
build
)
&&
build
.
playable?
build
.
playable?
&&
can?
(
request
.
user
,
:play_build
,
build
)
end
end
def
detailed_status
def
detailed_status
...
...
app/serializers/pipeline_entity.rb
View file @
72307940
...
@@ -48,15 +48,15 @@ class PipelineEntity < Grape::Entity
...
@@ -48,15 +48,15 @@ class PipelineEntity < Grape::Entity
end
end
expose
:commit
,
using:
CommitEntity
expose
:commit
,
using:
CommitEntity
expose
:yaml_errors
,
if:
->
(
pipeline
,
_
)
{
pipeline
.
has_yaml_errors?
}
expose
:yaml_errors
,
if:
->
(
pipeline
,
_
)
{
pipeline
.
has_yaml_errors?
}
expose
:retry_path
,
if:
proc
{
can_retry?
}
do
|
pipeline
|
expose
:retry_path
,
if:
->
(
*
)
{
can_retry?
}
do
|
pipeline
|
retry_namespace_project_pipeline_path
(
pipeline
.
project
.
namespace
,
retry_namespace_project_pipeline_path
(
pipeline
.
project
.
namespace
,
pipeline
.
project
,
pipeline
.
project
,
pipeline
.
id
)
pipeline
.
id
)
end
end
expose
:cancel_path
,
if:
proc
{
can_cancel?
}
do
|
pipeline
|
expose
:cancel_path
,
if:
->
(
*
)
{
can_cancel?
}
do
|
pipeline
|
cancel_namespace_project_pipeline_path
(
pipeline
.
project
.
namespace
,
cancel_namespace_project_pipeline_path
(
pipeline
.
project
.
namespace
,
pipeline
.
project
,
pipeline
.
project
,
pipeline
.
id
)
pipeline
.
id
)
...
...
app/services/ci/play_build_service.rb
View file @
72307940
...
@@ -5,7 +5,7 @@ module Ci
...
@@ -5,7 +5,7 @@ module Ci
raise
Gitlab
::
Access
::
AccessDeniedError
raise
Gitlab
::
Access
::
AccessDeniedError
end
end
# Try to enqueue thebuild, otherwise create a duplicate.
# Try to enqueue the
build, otherwise create a duplicate.
#
#
if
build
.
enqueue
if
build
.
enqueue
build
.
tap
{
|
action
|
action
.
update
(
user:
current_user
)
}
build
.
tap
{
|
action
|
action
.
update
(
user:
current_user
)
}
...
...
spec/controllers/projects/builds_controller_spec.rb
View file @
72307940
...
@@ -260,10 +260,8 @@ describe Projects::BuildsController do
...
@@ -260,10 +260,8 @@ describe Projects::BuildsController do
end
end
describe
'POST play'
do
describe
'POST play'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
before
do
before
do
project
.
add_
develop
er
(
user
)
project
.
add_
mast
er
(
user
)
sign_in
(
user
)
sign_in
(
user
)
post_play
post_play
...
...
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