Remove Issuable#add_labels_by_names

parent ed7591f7
...@@ -230,18 +230,6 @@ module Issuable ...@@ -230,18 +230,6 @@ module Issuable
labels.order('title ASC').pluck(:title) labels.order('title ASC').pluck(:title)
end end
def add_labels_by_names(label_names, current_user)
available_labels = LabelsFinder.new(current_user, project_id: project.id).execute
label_names.each do |label_name|
title = label_name.strip
label = available_labels.find_by(title: title)
label ||= project.labels.build(title: title, color: Label::DEFAULT_COLOR)
self.labels << label
end
end
# Convert this Issuable class name to a format usable by Ability definitions # Convert this Issuable class name to a format usable by Ability definitions
# #
# Examples: # Examples:
......
...@@ -122,25 +122,20 @@ module Gitlab ...@@ -122,25 +122,20 @@ module Gitlab
author_id = user_info(bug['ixPersonOpenedBy'])[:gitlab_id] || project.creator_id author_id = user_info(bug['ixPersonOpenedBy'])[:gitlab_id] || project.creator_id
issue = Issue.create!( issue = Issue.create!(
iid: bug['ixBug'],
project_id: project.id, project_id: project.id,
title: bug['sTitle'], title: bug['sTitle'],
description: body, description: body,
author_id: author_id, author_id: author_id,
assignee_id: assignee_id, assignee_id: assignee_id,
state: bug['fOpen'] == 'true' ? 'opened' : 'closed' state: bug['fOpen'] == 'true' ? 'opened' : 'closed',
created_at: date,
updated_at: DateTime.parse(bug['dtLastUpdated'])
) )
issue.add_labels_by_names(labels, project.creator)
if issue.iid != bug['ixBug'] issue.update_attribute(:label_ids, project.labels.where(title: labels).pluck(:id))
issue.update_attribute(:iid, bug['ixBug'])
end
import_issue_comments(issue, comments) import_issue_comments(issue, comments)
issue.update_attribute(:created_at, date)
last_update = DateTime.parse(bug['dtLastUpdated'])
issue.update_attribute(:updated_at, last_update)
end end
end end
......
...@@ -92,19 +92,16 @@ module Gitlab ...@@ -92,19 +92,16 @@ module Gitlab
end end
issue = Issue.create!( issue = Issue.create!(
iid: raw_issue['id'],
project_id: project.id, project_id: project.id,
title: raw_issue["title"], title: raw_issue['title'],
description: body, description: body,
author_id: project.creator_id, author_id: project.creator_id,
assignee_id: assignee_id, assignee_id: assignee_id,
state: raw_issue["state"] == "closed" ? "closed" : "opened" state: raw_issue['state'] == 'closed' ? 'closed' : 'opened'
) )
issue.add_labels_by_names(labels, project.creator) issue.update_attribute(:label_ids, project.labels.where(title: labels).pluck(:id))
if issue.iid != raw_issue["id"]
issue.update_attribute(:iid, raw_issue["id"])
end
import_issue_comments(issue, comments) import_issue_comments(issue, comments)
end end
......
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