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
diff options
context:
space:
mode:
Diffstat (limited to 'app/services/todo_service.rb')
-rw-r--r--app/services/todo_service.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb
index 0df61ad3bce..4fe6c1ec986 100644
--- a/app/services/todo_service.rb
+++ b/app/services/todo_service.rb
@@ -41,6 +41,7 @@ class TodoService
# collects the todo users before the todos themselves are deleted, then
# updates the todo counts for those users.
#
+ # rubocop: disable CodeReuse/ActiveRecord
def destroy_target(target)
todo_users = User.where(id: target.todos.pending.select(:user_id)).to_a
@@ -48,6 +49,7 @@ class TodoService
todo_users.each(&:update_todos_count_cache)
end
+ # rubocop: enable CodeReuse/ActiveRecord
# When we reassign an issue we should:
#
@@ -198,16 +200,21 @@ class TodoService
create_todos(current_user, attributes)
end
+ # rubocop: disable CodeReuse/ActiveRecord
def todo_exist?(issuable, current_user)
TodosFinder.new(current_user).execute.exists?(target: issuable)
end
+ # rubocop: enable CodeReuse/ActiveRecord
private
+ # rubocop: disable CodeReuse/ActiveRecord
def todos_by_ids(ids, current_user)
current_user.todos.where(id: Array(ids))
end
+ # rubocop: enable CodeReuse/ActiveRecord
+ # rubocop: disable CodeReuse/ActiveRecord
def update_todos_state(todos, current_user, state)
# Only update those that are not really on that state
todos = todos.where.not(state: state)
@@ -216,6 +223,7 @@ class TodoService
current_user.update_todos_count_cache
todos_ids
end
+ # rubocop: enable CodeReuse/ActiveRecord
def create_todos(users, attributes)
Array(users).map do |user|
@@ -340,8 +348,10 @@ class TodoService
end
end
+ # rubocop: disable CodeReuse/ActiveRecord
def pending_todos(user, criteria = {})
valid_keys = [:project_id, :target_id, :target_type, :commit_id]
user.todos.pending.where(criteria.slice(*valid_keys))
end
+ # rubocop: enable CodeReuse/ActiveRecord
end