API: refactored last fix, project limit in web client is fixed too
The previous call `saved?` is restored in the `POST /projects` method in the API. It is refactored to check if the record is persisted. This is useful to not validate the record again after saving. This fixes the returned status code in the web client too. If the last project is created via web client instead of error notification the project page is shown.
This commit is contained in:
parent
7e45ba7004
commit
3025824415
2 changed files with 2 additions and 2 deletions
|
@ -146,7 +146,7 @@ class Project < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def saved?
|
def saved?
|
||||||
id && valid?
|
id && persisted?
|
||||||
end
|
end
|
||||||
|
|
||||||
def import?
|
def import?
|
||||||
|
|
|
@ -44,7 +44,7 @@ module Gitlab
|
||||||
:merge_requests_enabled,
|
:merge_requests_enabled,
|
||||||
:wiki_enabled]
|
:wiki_enabled]
|
||||||
@project = ::Projects::CreateContext.new(current_user, attrs).execute
|
@project = ::Projects::CreateContext.new(current_user, attrs).execute
|
||||||
if @project.persisted?
|
if @project.saved?
|
||||||
present @project, with: Entities::Project
|
present @project, with: Entities::Project
|
||||||
else
|
else
|
||||||
not_found!
|
not_found!
|
||||||
|
|
Loading…
Reference in a new issue