diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2018-06-21 09:24:03 +0300 |
---|---|---|
committer | Jarka Kadlecová <jarka@gitlab.com> | 2018-07-03 10:34:44 +0300 |
commit | 7458ca8ebb093af93c01cb61dabca15fd0c995cb (patch) | |
tree | dd8adc950f0ac762c4236a5f81519b89edf4aec7 /lib/api | |
parent | 57a44f2da3d2a0b59209b6c2d653d04efd0d3d41 (diff) |
[backend] Addressed review comments
* Group filtering now includes also issues/MRs from
subgroups/subprojects
* fixed due_date
* Also DRYed todo controller specs
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/entities.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 375114f524b..06671c84fab 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -769,14 +769,14 @@ module API class Todo < Grape::Entity expose :id - expose :project, using: Entities::ProjectIdentity, if: -> (todo, _) { todo.project } - expose :group, using: 'API::Entities::NamespaceBasic', if: -> (todo, _) { todo.group } + expose :project, using: Entities::ProjectIdentity, if: -> (todo, _) { todo.project_id } + expose :group, using: 'API::Entities::NamespaceBasic', if: -> (todo, _) { todo.group_id } expose :author, using: Entities::UserBasic expose :action_name expose :target_type expose :target do |todo, options| - Entities.const_get(todo.target_type).represent(todo.target, options) + todo_target_class(todo.target_type).represent(todo.target, options) end expose :target_url do |todo, options| @@ -792,6 +792,10 @@ module API expose :body expose :state expose :created_at + + def todo_target_class(target_type) + ::API::Entities.const_get(target_type) + end end class NamespaceBasic < Grape::Entity |