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:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-03-13 15:32:33 +0300
committerBob Van Landuyt <bob@vanlanduyt.co>2018-03-14 15:39:08 +0300
commitca8f1ed9bbded05218c0d0398a1f96a6e03ecf53 (patch)
treecc88ccf8802c03c619e858e9b606fba280b92731 /lib
parent5ae91f323d054341c0d012de85835ef40f1bf9f8 (diff)
Import multiple issue assignees from GitLab export
When importing from a GitLab archive, an admin can carry over the assignations. Other users can not. When a regular user is importing an issue with multiple assignees, the assignee is replaced with the current user, meaning we would try to insert current user as an assignee multiple times. By filtering the array before storing it, the import becomes more robust.
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/import_export/relation_factory.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/gitlab/import_export/relation_factory.rb b/lib/gitlab/import_export/relation_factory.rb
index cf6b7e306dd..791a54e1b69 100644
--- a/lib/gitlab/import_export/relation_factory.rb
+++ b/lib/gitlab/import_export/relation_factory.rb
@@ -70,6 +70,7 @@ module Gitlab
update_user_references
update_project_references
+ remove_duplicate_assignees
reset_tokens!
remove_encrypted_attributes!
@@ -83,6 +84,14 @@ module Gitlab
end
end
+ def remove_duplicate_assignees
+ return unless @relation_hash['issue_assignees']
+
+ # When an assignee did not exist in the members mapper, the importer is
+ # assigned. We only need to assign each user once.
+ @relation_hash['issue_assignees'].uniq!(&:user_id)
+ end
+
def setup_note
set_note_author
# attachment is deprecated and note uploads are handled by Markdown uploader