BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
7ef156a2
Commit
7ef156a2
authored
Oct 12, 2015
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add author to statuses
parent
88749476
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
1 deletion
+11
-1
commit_status.rb
app/models/commit_status.rb
+2
-0
commit_statuses.rb
lib/api/commit_statuses.rb
+1
-1
entities.rb
lib/api/entities.rb
+1
-0
commit_status_spec.rb
spec/models/commit_status_spec.rb
+7
-0
No files found.
app/models/commit_status.rb
View file @
7ef156a2
...
...
@@ -9,6 +9,8 @@ class CommitStatus < ActiveRecord::Base
validates_presence_of
:name
alias_attribute
:author
,
:user
scope
:running
,
->
()
{
where
(
status:
'running'
)
}
scope
:pending
,
->
()
{
where
(
status:
'pending'
)
}
scope
:success
,
->
()
{
where
(
status:
'success'
)
}
...
...
lib/api/commit_statuses.rb
View file @
7ef156a2
...
...
@@ -52,7 +52,7 @@ module API
name
=
params
[
:name
]
||
params
[
:context
]
status
=
GenericCommitStatus
.
running_or_pending
.
find_by
(
commit:
ci_commit
,
name:
name
,
ref:
params
[
:ref
])
status
=
GenericCommitStatus
.
new
(
commit:
ci_commit
)
unless
status
status
=
GenericCommitStatus
.
new
(
commit:
ci_commit
,
user:
current_user
)
unless
status
status
.
update
(
attrs
)
case
params
[
:state
].
to_s
...
...
lib/api/entities.rb
View file @
7ef156a2
...
...
@@ -232,6 +232,7 @@ module API
class
CommitStatus
<
Grape
::
Entity
expose
:id
,
:sha
,
:ref
,
:status
,
:name
,
:target_url
,
:description
,
:created_at
,
:started_at
,
:finished_at
expose
:author
,
using:
Entities
::
UserBasic
end
class
Event
<
Grape
::
Entity
...
...
spec/models/commit_status_spec.rb
View file @
7ef156a2
...
...
@@ -18,6 +18,13 @@ describe CommitStatus do
it
{
is_expected
.
to
respond_to
:running?
}
it
{
is_expected
.
to
respond_to
:pending?
}
describe
:author
do
subject
{
commit_status
.
author
}
before
{
commit_status
.
author
=
User
.
new
}
it
{
is_expected
.
to
eq
(
commit_status
.
user
)
}
end
describe
:started?
do
subject
{
commit_status
.
started?
}
...
...
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