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, 8 insertions, 2 deletions
diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb
index 1f6cf2c83c9..be7405cc896 100644
--- a/app/services/todo_service.rb
+++ b/app/services/todo_service.rb
@@ -168,7 +168,7 @@ class TodoService
def mark_todo(target, current_user)
project = target.project
attributes = attributes_for_todo(project, target, current_user, Todo::MARKED)
- create_todos(current_user, attributes, project&.namespace, project)
+ create_todos(current_user, attributes, target_namespace(target), project)
end
def todo_exist?(issuable, current_user)
@@ -338,7 +338,7 @@ class TodoService
project = target.project
assignees = target.assignees - old_assignees
attributes = attributes_for_todo(project, target, author, Todo::ASSIGNED)
- create_todos(assignees, attributes, project.namespace, project)
+ create_todos(assignees, attributes, target_namespace(target), project)
end
end
@@ -386,6 +386,7 @@ class TodoService
attributes.merge!(target_id: nil, commit_id: target.id)
when Issue
attributes[:issue_type] = target.issue_type
+ attributes[:group] = target.namespace if target.project.blank?
when Discussion
attributes.merge!(target_type: nil, target_id: nil, discussion: target)
end
@@ -469,6 +470,11 @@ class TodoService
attributes
end
+
+ def target_namespace(target)
+ project = target.project
+ project&.namespace || target.try(:namespace)
+ end
end
TodoService.prepend_mod_with('TodoService')