Commit 39c215be authored by Stan Hu's avatar Stan Hu

Fix nil user handling in UpdateMirrorService

Closes #605
parent e8c06f42
Please view this file on the master branch, on stable branches it's out of date. Please view this file on the master branch, on stable branches it's out of date.
v 8.9.0 (unreleased) v 8.9.0 (unreleased)
- Fix nil user handling in UpdateMirrorService
v 8.8.3 v 8.8.3
- Make it clear the license overusage is visible only to admins - Make it clear the license overusage is visible only to admins
......
...@@ -6,7 +6,7 @@ module Projects ...@@ -6,7 +6,7 @@ module Projects
def execute def execute
return false unless project.mirror? return false unless project.mirror?
unless current_user.can?(:push_code_to_protected_branches, project) unless can?(current_user, :push_code_to_protected_branches, project)
return error("The mirror user is not allowed to push code to all branches on this project.") return error("The mirror user is not allowed to push code to all branches on this project.")
end end
......
...@@ -75,6 +75,16 @@ describe Projects::UpdateMirrorService do ...@@ -75,6 +75,16 @@ describe Projects::UpdateMirrorService do
expect(result[:status]).to eq(:error) expect(result[:status]).to eq(:error)
end end
end end
describe "when no user is present" do
let(:mirror_user) { }
it "fails" do
result = subject.execute
expect(result[:status]).to eq(:error)
end
end
end end
def fetch_mirror(repository) def fetch_mirror(repository)
......
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