diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2016-11-02 22:37:56 +0200 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2016-11-04 15:59:53 +0200 |
commit | eaa0303b3d2f1480222c94a85d356b055f7100b3 (patch) | |
tree | 9046e886e6ad0490b1e6f44453404a729aa4ed45 | |
parent | 6a9fb20fe157fba158a79d645742239796239124 (diff) | |
download | gitlab-ce-eaa0303b3d2f1480222c94a85d356b055f7100b3.tar.gz |
Cache imported GH labels no matter whatfix/gh-imported-labels-are-not-applied-correctly
-rw-r--r-- | lib/gitlab/github_import/importer.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/gitlab/github_import/importer.rb b/lib/gitlab/github_import/importer.rb index bdabc71194d..90cf38a8513 100644 --- a/lib/gitlab/github_import/importer.rb +++ b/lib/gitlab/github_import/importer.rb @@ -52,15 +52,14 @@ module Gitlab fetch_resources(:labels, repo, per_page: 100) do |labels| labels.each do |raw| begin - label = LabelFormatter.new(project, raw).create! - @labels[label.title] = label.id + LabelFormatter.new(project, raw).create! rescue => e errors << { type: :label, url: Gitlab::UrlSanitizer.sanitize(raw.url), errors: e.message } end end end - ensure_labels_are_cached + cache_labels! end def import_milestones @@ -236,9 +235,7 @@ module Gitlab end end - def ensure_labels_are_cached - return unless @labels.empty? - + def cache_labels! project.labels.select(:id, :title).find_each do |label| @labels[label.title] = label.id end |