diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb
index 1647d693a9dacb89248208924e45a1f2ad76b7a6..fee68d9cc8fbedee47eb09187b7954d3abe07f56 100644
--- a/app/models/concerns/issuable.rb
+++ b/app/models/concerns/issuable.rb
@@ -234,19 +234,13 @@ module Issuable
     labels.delete_all
   end
 
-  def add_labels_by_names(label_names)
-    label_ids = []
-    label_ids << project.group.labels.select(:id) if project.group.present?
-    label_ids << project.labels.select(:id)
-
-    union = Gitlab::SQL::Union.new(label_ids)
-
-    available_labels = Label.where("labels.id IN (#{union.to_sql})")
+  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) if label.nil?
+      label ||= project.labels.build(title: title, color: Label::DEFAULT_COLOR)
 
       self.labels << label
     end
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb
index 2b685621da9a0c4443e30962ae59a98b490f395e..67fdd0be9276258277ccdc9df0609d0948ce319a 100644
--- a/lib/api/merge_requests.rb
+++ b/lib/api/merge_requests.rb
@@ -91,7 +91,7 @@ module API
         if merge_request.valid?
           # Find or create labels and attach to issue
           if params[:labels].present?
-            merge_request.add_labels_by_names(params[:labels].split(","))
+            merge_request.add_labels_by_names(params[:labels].split(","), current_user)
           end
 
           present merge_request, with: Entities::MergeRequest, current_user: current_user
@@ -201,7 +201,7 @@ module API
             # Find or create labels and attach to issue
             unless params[:labels].nil?
               merge_request.remove_labels
-              merge_request.add_labels_by_names(params[:labels].split(","))
+              merge_request.add_labels_by_names(params[:labels].split(","), current_user)
             end
 
             present merge_request, with: Entities::MergeRequest, current_user: current_user
diff --git a/lib/gitlab/fogbugz_import/importer.rb b/lib/gitlab/fogbugz_import/importer.rb
index 501d5a955478abb6aa4cc112e1446bfe1d313d30..1d6f97b99c71aaea6489bd4de07eda4f3965891e 100644
--- a/lib/gitlab/fogbugz_import/importer.rb
+++ b/lib/gitlab/fogbugz_import/importer.rb
@@ -129,7 +129,7 @@ module Gitlab
             assignee_id:  assignee_id,
             state:        bug['fOpen'] == 'true' ? 'opened' : 'closed'
           )
-          issue.add_labels_by_names(labels)
+          issue.add_labels_by_names(labels, project.creator)
 
           if issue.iid != bug['ixBug']
             issue.update_attribute(:iid, bug['ixBug'])
diff --git a/lib/gitlab/google_code_import/importer.rb b/lib/gitlab/google_code_import/importer.rb
index ef8c3e35619c6646dd8d5cb912aacc8f13dc625a..8d757da22640dc58313362b08c57ef49f695fdf0 100644
--- a/lib/gitlab/google_code_import/importer.rb
+++ b/lib/gitlab/google_code_import/importer.rb
@@ -100,7 +100,7 @@ module Gitlab
             state:        raw_issue["state"] == "closed" ? "closed" : "opened"
           )
 
-          issue.add_labels_by_names(labels)
+          issue.add_labels_by_names(labels, project.creator)
 
           if issue.iid != raw_issue["id"]
             issue.update_attribute(:iid, raw_issue["id"])
diff --git a/spec/lib/gitlab/google_code_import/importer_spec.rb b/spec/lib/gitlab/google_code_import/importer_spec.rb
index 54f85f8cffc699b19249a77696ad98e1c06a562c..097861fd34db95f76b64710e5e1acc351fb527be 100644
--- a/spec/lib/gitlab/google_code_import/importer_spec.rb
+++ b/spec/lib/gitlab/google_code_import/importer_spec.rb
@@ -15,6 +15,7 @@ describe Gitlab::GoogleCodeImport::Importer, lib: true do
   subject { described_class.new(project) }
 
   before do
+    project.team << [project.creator, :master]
     project.create_import_data(data: import_data)
   end
 
@@ -31,9 +32,9 @@ describe Gitlab::GoogleCodeImport::Importer, lib: true do
       subject.execute
 
       %w(
-        Type-Defect Type-Enhancement Type-Task Type-Review Type-Other Milestone-0.12 Priority-Critical 
-        Priority-High Priority-Medium Priority-Low OpSys-All OpSys-Windows OpSys-Linux OpSys-OSX Security 
-        Performance Usability Maintainability Component-Panel Component-Taskbar Component-Battery 
+        Type-Defect Type-Enhancement Type-Task Type-Review Type-Other Milestone-0.12 Priority-Critical
+        Priority-High Priority-Medium Priority-Low OpSys-All OpSys-Windows OpSys-Linux OpSys-OSX Security
+        Performance Usability Maintainability Component-Panel Component-Taskbar Component-Battery
         Component-Systray Component-Clock Component-Launcher Component-Tint2conf Component-Docs Component-New
       ).each do |label|
         label.sub!("-", ": ")