Commit 3025824415184c16f86bb67276474113de48d813

Authored by Sebastian Ziebell
1 parent 7e45ba70

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.
Showing 2 changed files with 2 additions and 2 deletions   Show diff stats
app/models/project.rb
@@ -146,7 +146,7 @@ class Project < ActiveRecord::Base @@ -146,7 +146,7 @@ class Project < ActiveRecord::Base
146 end 146 end
147 147
148 def saved? 148 def saved?
149 - id && valid? 149 + id && persisted?
150 end 150 end
151 151
152 def import? 152 def import?
lib/api/projects.rb
@@ -44,7 +44,7 @@ module Gitlab @@ -44,7 +44,7 @@ module Gitlab
44 :merge_requests_enabled, 44 :merge_requests_enabled,
45 :wiki_enabled] 45 :wiki_enabled]
46 @project = ::Projects::CreateContext.new(current_user, attrs).execute 46 @project = ::Projects::CreateContext.new(current_user, attrs).execute
47 - if @project.persisted? 47 + if @project.saved?
48 present @project, with: Entities::Project 48 present @project, with: Entities::Project
49 else 49 else
50 not_found! 50 not_found!