Commit 3ea988e8 authored by Stan Hu's avatar Stan Hu

Fix Groups::UpdateService#execute not returning correct error code

This was causing problems in EE, where audit events were being
generated even if the project failed to save.
parent c5d8e7fc
...@@ -14,9 +14,11 @@ module Groups ...@@ -14,9 +14,11 @@ module Groups
group.assign_attributes(params) group.assign_attributes(params)
begin begin
after_update if group.save success = group.save
true after_update if success
success
rescue Gitlab::UpdatePathError => e rescue Gitlab::UpdatePathError => e
group.errors.add(:base, e.message) group.errors.add(:base, e.message)
......
...@@ -24,6 +24,12 @@ describe Groups::UpdateService do ...@@ -24,6 +24,12 @@ describe Groups::UpdateService do
expect(TodosDestroyer::GroupPrivateWorker).not_to receive(:perform_in) expect(TodosDestroyer::GroupPrivateWorker).not_to receive(:perform_in)
end end
it "returns false if save failed" do
allow(public_group).to receive(:save).and_return(false)
expect(service.execute).to be_falsey
end
end end
context "internal group with internal project" do context "internal group with internal project" do
......
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