Commit 6343a3c4 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '21772-expand-gl-method-names-in-importer-classes' into 'master'

Rename `gl_user_id` to `gitlab_user_id` in importer classes

Closes #21772

See merge request !6254
parents b81db024 9a9e22a8
...@@ -21,7 +21,7 @@ module Gitlab ...@@ -21,7 +21,7 @@ module Gitlab
private private
def gl_user_id(project, bitbucket_id) def gitlab_user_id(project, bitbucket_id)
if bitbucket_id if bitbucket_id
user = User.joins(:identities).find_by("identities.extern_uid = ? AND identities.provider = 'bitbucket'", bitbucket_id.to_s) user = User.joins(:identities).find_by("identities.extern_uid = ? AND identities.provider = 'bitbucket'", bitbucket_id.to_s)
(user && user.id) || project.creator_id (user && user.id) || project.creator_id
...@@ -74,7 +74,7 @@ module Gitlab ...@@ -74,7 +74,7 @@ module Gitlab
description: body, description: body,
title: issue["title"], title: issue["title"],
state: %w(resolved invalid duplicate wontfix closed).include?(issue["status"]) ? 'closed' : 'opened', state: %w(resolved invalid duplicate wontfix closed).include?(issue["status"]) ? 'closed' : 'opened',
author_id: gl_user_id(project, reporter) author_id: gitlab_user_id(project, reporter)
) )
end end
rescue ActiveRecord::RecordInvalid => e rescue ActiveRecord::RecordInvalid => e
......
...@@ -15,7 +15,7 @@ module Gitlab ...@@ -15,7 +15,7 @@ module Gitlab
private private
def gl_user_id(github_id) def gitlab_user_id(github_id)
User.joins(:identities). User.joins(:identities).
find_by("identities.extern_uid = ? AND identities.provider = 'github'", github_id.to_s). find_by("identities.extern_uid = ? AND identities.provider = 'github'", github_id.to_s).
try(:id) try(:id)
......
...@@ -21,7 +21,7 @@ module Gitlab ...@@ -21,7 +21,7 @@ module Gitlab
end end
def author_id def author_id
gl_user_id(raw_data.user.id) || project.creator_id gitlab_user_id(raw_data.user.id) || project.creator_id
end end
def body def body
......
...@@ -40,7 +40,7 @@ module Gitlab ...@@ -40,7 +40,7 @@ module Gitlab
def assignee_id def assignee_id
if assigned? if assigned?
gl_user_id(raw_data.assignee.id) gitlab_user_id(raw_data.assignee.id)
end end
end end
...@@ -49,7 +49,7 @@ module Gitlab ...@@ -49,7 +49,7 @@ module Gitlab
end end
def author_id def author_id
gl_user_id(raw_data.user.id) || project.creator_id gitlab_user_id(raw_data.user.id) || project.creator_id
end end
def body def body
......
...@@ -68,7 +68,7 @@ module Gitlab ...@@ -68,7 +68,7 @@ module Gitlab
def assignee_id def assignee_id
if assigned? if assigned?
gl_user_id(raw_data.assignee.id) gitlab_user_id(raw_data.assignee.id)
end end
end end
...@@ -77,7 +77,7 @@ module Gitlab ...@@ -77,7 +77,7 @@ module Gitlab
end end
def author_id def author_id
gl_user_id(raw_data.user.id) || project.creator_id gitlab_user_id(raw_data.user.id) || project.creator_id
end end
def body def body
......
...@@ -41,7 +41,7 @@ module Gitlab ...@@ -41,7 +41,7 @@ module Gitlab
title: issue["title"], title: issue["title"],
state: issue["state"], state: issue["state"],
updated_at: issue["updated_at"], updated_at: issue["updated_at"],
author_id: gl_user_id(project, issue["author"]["id"]) author_id: gitlab_user_id(project, issue["author"]["id"])
) )
end end
end end
...@@ -51,7 +51,7 @@ module Gitlab ...@@ -51,7 +51,7 @@ module Gitlab
private private
def gl_user_id(project, gitlab_id) def gitlab_user_id(project, gitlab_id)
user = User.joins(:identities).find_by("identities.extern_uid = ? AND identities.provider = 'gitlab'", gitlab_id.to_s) user = User.joins(:identities).find_by("identities.extern_uid = ? AND identities.provider = 'gitlab'", gitlab_id.to_s)
(user && user.id) || project.creator_id (user && user.id) || project.creator_id
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