diff options
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/entities.rb | 8 | ||||
-rw-r--r-- | lib/api/todos.rb | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 67d2c396b32..8cc4368b5c2 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -277,16 +277,16 @@ module API expose :project, using: Entities::BasicProjectDetails expose :author, using: Entities::UserBasic expose :action_name - expose :target_id expose :target_type - expose :target_reference do |todo, options| - todo.target.to_reference + + expose :target do |todo, options| + Entities.const_get(todo.target_type).represent(todo.target, options) end expose :target_url do |todo, options| target_type = todo.target_type.underscore target_url = "namespace_project_#{target_type}_url" - target_anchor = "note_#{todo.note_id}" if todo.note.present? + target_anchor = "note_#{todo.note_id}" if todo.note_id? Gitlab::Application.routes.url_helpers.public_send(target_url, todo.project.namespace, todo.project, todo.target, anchor: target_anchor) diff --git a/lib/api/todos.rb b/lib/api/todos.rb index 67714a796c7..8334baad1b9 100644 --- a/lib/api/todos.rb +++ b/lib/api/todos.rb @@ -18,7 +18,7 @@ module API get do todos = find_todos - present paginate(todos), with: Entities::Todo + present paginate(todos), with: Entities::Todo, current_user: current_user end # Mark a todo as done @@ -33,7 +33,7 @@ module API todo = current_user.todos.find(params[:id]) todo.done - present todo, with: Entities::Todo + present todo, with: Entities::Todo, current_user: current_user end # Mark all todos as done @@ -45,7 +45,7 @@ module API todos = find_todos todos.each(&:done) - present paginate(Kaminari.paginate_array(todos)), with: Entities::Todo + present paginate(Kaminari.paginate_array(todos)), with: Entities::Todo, current_user: current_user end end end |