summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAhmad Sherif <me@ahmadsherif.com>2016-11-02 16:23:46 +0200
committerAhmad Sherif <me@ahmadsherif.com>2016-11-04 15:59:53 +0200
commit6a9fb20fe157fba158a79d645742239796239124 (patch)
tree72eb61086598f61da6f60b4a04ceaf910f2fe77b
parenta3cc2f1e8dfcfb2f3e181fa570ed2ba245f9a069 (diff)
downloadgitlab-ce-6a9fb20fe157fba158a79d645742239796239124.tar.gz
Fix applying GitHub-imported labels when importing job is interrupted
Closes #24075
-rw-r--r--CHANGELOG.md1
-rw-r--r--lib/gitlab/github_import/importer.rb10
2 files changed, 11 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9411cc62003..c055d1f384e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -66,6 +66,7 @@ entry.
- In all filterable drop downs, put input field in focus only after load is complete (Ido @leibo)
- Improve search query parameter naming in /admin/users !7115 (YarNayar)
- Fix table pagination to be responsive
+- Fix applying GitHub-imported labels when importing job is interrupted
- Allow to search for user by secondary email address in the admin interface(/admin/users) !7115 (YarNayar)
- Updated commit SHA styling on the branches page.
diff --git a/lib/gitlab/github_import/importer.rb b/lib/gitlab/github_import/importer.rb
index ecc28799737..bdabc71194d 100644
--- a/lib/gitlab/github_import/importer.rb
+++ b/lib/gitlab/github_import/importer.rb
@@ -59,6 +59,8 @@ module Gitlab
end
end
end
+
+ ensure_labels_are_cached
end
def import_milestones
@@ -234,6 +236,14 @@ module Gitlab
end
end
+ def ensure_labels_are_cached
+ return unless @labels.empty?
+
+ project.labels.select(:id, :title).find_each do |label|
+ @labels[label.title] = label.id
+ end
+ end
+
def fetch_resources(resource_type, *opts)
return if imported?(resource_type)