diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-03-13 13:32:33 +0100 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-03-14 13:39:08 +0100 |
commit | ca8f1ed9bbded05218c0d0398a1f96a6e03ecf53 (patch) | |
tree | cc88ccf8802c03c619e858e9b606fba280b92731 /lib | |
parent | 5ae91f323d054341c0d012de85835ef40f1bf9f8 (diff) | |
download | gitlab-ce-ca8f1ed9bbded05218c0d0398a1f96a6e03ecf53.tar.gz |
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.rb | 9 |
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 |