Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2016-06-22 20:15:09 +0300
committerRobert Schilling <rschilling@student.tugraz.at>2016-07-01 15:52:04 +0300
commit3942621329b20307c1676d60324c8f47ea1e1b37 (patch)
tree45ec7ce2810878a7951946754cad10fad28642ab /lib
parentfd9cd5ae8cd2d2f5488635b264eb86d89d768d66 (diff)
Expose target, filter by state as string
Diffstat (limited to 'lib')
-rw-r--r--lib/api/entities.rb8
-rw-r--r--lib/api/todos.rb6
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