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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-09-09 15:08:22 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-09-09 15:08:22 +0300
commitd022b7432efd720f0cf5f8d2a2cdaac7619bab57 (patch)
tree5b6e0a107019e8160957624380919913b084a68d /app/services/todo_service.rb
parent73add99b1f4ce720f1fe00e828fb6991f27af6fb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/todo_service.rb')
-rw-r--r--app/services/todo_service.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/services/todo_service.rb b/app/services/todo_service.rb
index a3db2ae7947..1220b4cbe29 100644
--- a/app/services/todo_service.rb
+++ b/app/services/todo_service.rb
@@ -57,6 +57,14 @@ class TodoService
create_assignment_todo(issuable, current_user, old_assignees)
end
+ # When we reassign an reviewable object (merge request) we should:
+ #
+ # * create a pending todo for new reviewer if object is assigned
+ #
+ def reassigned_reviewable(issuable, current_user, old_reviewers = [])
+ create_reviewer_todo(issuable, current_user, old_reviewers)
+ end
+
# When create a merge request we should:
#
# * creates a pending todo for assignee if merge request is assigned
@@ -217,6 +225,7 @@ class TodoService
def new_issuable(issuable, author)
create_assignment_todo(issuable, author)
+ create_reviewer_todo(issuable, author) if issuable.allows_reviewers?
create_mention_todos(issuable.project, issuable, author)
end
@@ -250,6 +259,14 @@ class TodoService
end
end
+ def create_reviewer_todo(target, author, old_reviewers = [])
+ if target.reviewers.any?
+ reviewers = target.reviewers - old_reviewers
+ attributes = attributes_for_todo(target.project, target, author, Todo::REVIEW_REQUESTED)
+ create_todos(reviewers, attributes)
+ end
+ end
+
def create_mention_todos(parent, target, author, note = nil, skip_users = [])
# Create Todos for directly addressed users
directly_addressed_users = filter_directly_addressed_users(parent, note || target, author, skip_users)