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.
This commit is contained in:
Stan Hu 2018-10-18 01:43:49 -07:00
parent c5d8e7fcee
commit 3ea988e854
2 changed files with 10 additions and 2 deletions

View File

@ -14,9 +14,11 @@ module Groups
group.assign_attributes(params)
begin
after_update if group.save
success = group.save
true
after_update if success
success
rescue Gitlab::UpdatePathError => e
group.errors.add(:base, e.message)

View File

@ -24,6 +24,12 @@ describe Groups::UpdateService do
expect(TodosDestroyer::GroupPrivateWorker).not_to receive(:perform_in)
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
context "internal group with internal project" do