Commit 0b94059b authored by charlie ablett's avatar charlie ablett

Use current_user rather than owner to log project creation

parent 68755b38
...@@ -89,7 +89,7 @@ module Projects ...@@ -89,7 +89,7 @@ module Projects
end end
def after_create_actions def after_create_actions
log_info("#{@project.owner.name} created a new project \"#{@project.full_name}\"") log_info("#{current_user.name} created a new project \"#{@project.full_name}\"")
if @project.import? if @project.import?
experiment(:combined_registration, user: current_user).track(:import_project) experiment(:combined_registration, user: current_user).track(:import_project)
......
...@@ -7,9 +7,10 @@ RSpec.describe Projects::CreateService, '#execute' do ...@@ -7,9 +7,10 @@ RSpec.describe Projects::CreateService, '#execute' do
include GitHelpers include GitHelpers
let(:user) { create :user } let(:user) { create :user }
let(:project_name) { 'GitLab' }
let(:opts) do let(:opts) do
{ {
name: 'GitLab', name: project_name,
namespace_id: user.namespace.id namespace_id: user.namespace.id
} }
end end
...@@ -144,6 +145,12 @@ RSpec.describe Projects::CreateService, '#execute' do ...@@ -144,6 +145,12 @@ RSpec.describe Projects::CreateService, '#execute' do
subject { create_project(user, opts) } subject { create_project(user, opts) }
end end
it 'logs creation' do
expect(Gitlab::AppLogger).to receive(:info).with(/#{user.name} created a new project/)
create_project(user, opts)
end
end end
context "admin creates project with other user's namespace_id" do context "admin creates project with other user's namespace_id" do
...@@ -202,7 +209,7 @@ RSpec.describe Projects::CreateService, '#execute' do ...@@ -202,7 +209,7 @@ RSpec.describe Projects::CreateService, '#execute' do
let(:opts) do let(:opts) do
{ {
name: 'GitLab', name: project_name,
namespace_id: shared_group.id namespace_id: shared_group.id
} }
end end
...@@ -237,7 +244,7 @@ RSpec.describe Projects::CreateService, '#execute' do ...@@ -237,7 +244,7 @@ RSpec.describe Projects::CreateService, '#execute' do
let(:share_max_access_level) { Gitlab::Access::MAINTAINER } let(:share_max_access_level) { Gitlab::Access::MAINTAINER }
let(:opts) do let(:opts) do
{ {
name: 'GitLab', name: project_name,
namespace_id: subgroup_for_projects.id namespace_id: subgroup_for_projects.id
} }
end end
...@@ -676,7 +683,7 @@ RSpec.describe Projects::CreateService, '#execute' do ...@@ -676,7 +683,7 @@ RSpec.describe Projects::CreateService, '#execute' do
let(:opts) do let(:opts) do
{ {
name: 'GitLab', name: project_name,
namespace_id: group.id namespace_id: group.id
} }
end end
...@@ -697,7 +704,7 @@ RSpec.describe Projects::CreateService, '#execute' do ...@@ -697,7 +704,7 @@ RSpec.describe Projects::CreateService, '#execute' do
let(:opts) do let(:opts) do
{ {
name: 'GitLab', name: project_name,
namespace_id: subgroup.id namespace_id: subgroup.id
} }
end end
...@@ -808,7 +815,7 @@ RSpec.describe Projects::CreateService, '#execute' do ...@@ -808,7 +815,7 @@ RSpec.describe Projects::CreateService, '#execute' do
let(:opts) do let(:opts) do
{ {
name: 'GitLab', name: project_name,
namespace_id: group.id namespace_id: group.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