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
Jérome Perrin
gitlab-ce
Commits
63176574
Commit
63176574
authored
Jun 15, 2016
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose action_name
parent
69397d55
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
1 deletion
+13
-1
app/models/todo.rb
app/models/todo.rb
+11
-0
lib/api/entities.rb
lib/api/entities.rb
+1
-1
spec/requests/api/todos_spec.rb
spec/requests/api/todos_spec.rb
+1
-0
No files found.
app/models/todo.rb
View file @
63176574
...
...
@@ -4,6 +4,13 @@ class Todo < ActiveRecord::Base
BUILD_FAILED
=
3
MARKED
=
4
ACTION_NAMES
=
{
ASSIGNED
=>
:assigned
,
MENTIONED
=>
:mentioned
,
BUILD_FAILED
=>
:build_failed
,
MARKED
=>
:marked
}
belongs_to
:author
,
class_name:
"User"
belongs_to
:note
belongs_to
:project
...
...
@@ -34,6 +41,10 @@ class Todo < ActiveRecord::Base
action
==
BUILD_FAILED
end
def
action_name
ACTION_NAMES
[
action
]
end
def
body
if
note
.
present?
note
.
note
...
...
lib/api/entities.rb
View file @
63176574
...
...
@@ -276,7 +276,7 @@ module API
expose
:id
expose
:project
,
using:
Entities
::
BasicProjectDetails
expose
:author
,
using:
Entities
::
UserBasic
#
expose :action_name
expose
:action_name
expose
:target_id
expose
:target_type
expose
:target_reference
do
|
todo
,
options
|
...
...
spec/requests/api/todos_spec.rb
View file @
63176574
...
...
@@ -44,6 +44,7 @@ describe API::Todos, api: true do
expect
(
json_response
[
0
][
'target_url'
]).
to
be_present
expect
(
json_response
[
0
][
'body'
]).
to
be_present
expect
(
json_response
[
0
][
'state'
]).
to
eq
(
'pending'
)
expect
(
json_response
[
0
][
'action_name'
]).
to
eq
(
'assigned'
)
expect
(
json_response
[
0
][
'created_at'
]).
to
be_present
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