diff options
Diffstat (limited to 'lib/api/todos.rb')
-rw-r--r-- | lib/api/todos.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/api/todos.rb b/lib/api/todos.rb index 02b8bb55274..e36ddf21277 100644 --- a/lib/api/todos.rb +++ b/lib/api/todos.rb @@ -6,8 +6,6 @@ module API before { authenticate! } - helpers ::Gitlab::IssuableMetadata - ISSUABLE_TYPES = { 'merge_requests' => ->(iid) { find_merge_request_with_access(iid) }, 'issues' => ->(iid) { find_project_issue(iid) } @@ -65,7 +63,7 @@ module API next unless collection targets = collection.map(&:target) - options[type] = { issuable_metadata: issuable_meta_data(targets, type, current_user) } + options[type] = { issuable_metadata: Gitlab::IssuableMetadata.new(current_user, targets).data } end end end @@ -91,16 +89,18 @@ module API requires :id, type: Integer, desc: 'The ID of the todo being marked as done' end post ':id/mark_as_done' do - TodoService.new.mark_todos_as_done_by_ids(params[:id], current_user) todo = current_user.todos.find(params[:id]) + TodoService.new.resolve_todo(todo, current_user, resolved_by_action: :api_done) + present todo, with: Entities::Todo, current_user: current_user end desc 'Mark all todos as done' post '/mark_as_done' do todos = find_todos - TodoService.new.mark_todos_as_done(todos, current_user) + + TodoService.new.resolve_todos(todos, current_user, resolved_by_action: :api_all_done) no_content! end |