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
alias_method
:build
,
:object
def
playable?
can?
(
request
.
user
,
:play_build
,
build
)
&&
build
.
playable?
build
.
playable?
&&
can?
(
request
.
user
,
:play_build
,
build
)
end
end
app/serializers/build_entity.rb
View file @
72307940
...
...
@@ -12,7 +12,7 @@ class BuildEntity < Grape::Entity
path_to
(
:retry_namespace_project_build
,
build
)
end
expose
:play_path
,
if:
proc
{
playable?
}
do
|
build
|
expose
:play_path
,
if:
->
(
*
)
{
playable?
}
do
|
build
|
path_to
(
:play_namespace_project_build
,
build
)
end
...
...
@@ -26,7 +26,7 @@ class BuildEntity < Grape::Entity
alias_method
:build
,
:object
def
playable?
can?
(
request
.
user
,
:play_build
,
build
)
&&
build
.
playable?
build
.
playable?
&&
can?
(
request
.
user
,
:play_build
,
build
)
end
def
detailed_status
...
...
app/serializers/pipeline_entity.rb
View file @
72307940
...
...
@@ -48,15 +48,15 @@ class PipelineEntity < Grape::Entity
end
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
,
pipeline
.
project
,
pipeline
.
id
)
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
,
pipeline
.
project
,
pipeline
.
id
)
...
...
app/services/ci/play_build_service.rb
View file @
72307940
...
...
@@ -5,7 +5,7 @@ module Ci
raise
Gitlab
::
Access
::
AccessDeniedError
end
# Try to enqueue thebuild, otherwise create a duplicate.
# Try to enqueue the
build, otherwise create a duplicate.
#
if
build
.
enqueue
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
end
describe
'POST play'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
before
do
project
.
add_
develop
er
(
user
)
project
.
add_
mast
er
(
user
)
sign_in
(
user
)
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