mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-14 15:16:04 +10:00
Expose action_name
This commit is contained in:
@@ -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
|
||||
|
||||
+1
-1
@@ -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|
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user