Commit 8d0d8b91 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'fix/gh-imported-labels-are-not-applied-correctly' into 'master'

Fix applying GitHub-imported labels when importing job is interrupted

Closes #24075

See merge request !7245
parents 86b8fb4e eaa0303b
......@@ -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.
......
......@@ -52,13 +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
cache_labels!
end
def import_milestones
......@@ -234,6 +235,12 @@ module Gitlab
end
end
def cache_labels!
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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment