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
This commit is contained in:
Sean McGivern 2016-11-04 18:48:41 +00:00
commit 8d0d8b91e4
2 changed files with 10 additions and 2 deletions

View file

@ -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.

View file

@ -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)