diff options
author | Cyril <jv.cyril@gmail.com> | 2012-12-12 17:53:43 +0100 |
---|---|---|
committer | Cyril <jv.cyril@gmail.com> | 2012-12-12 17:53:43 +0100 |
commit | 63d9373aa8722b69e7263f39af8e5194048b8b0d (patch) | |
tree | e87653e6e5850ebcb301922ab1050e5d0c59992f | |
parent | 273c0d2aa3238aee213efab07f52b78eab1af64f (diff) | |
download | gitlab-ce-63d9373aa8722b69e7263f39af8e5194048b8b0d.tar.gz |
Validates presence of User#name
The 2 reasons are :
- creation of user fail if name is empty : in after_save, it tries to create a
namespace with namespace.name = user.name and namespece validates presence
Namespace#name
- in the web app links to team members are broken with empty User#name because
they are of the form <a href'...'> user.name </a>
-rw-r--r-- | app/models/user.rb | 1 | ||||
-rw-r--r-- | doc/api/users.md | 2 | ||||
-rw-r--r-- | lib/api/users.rb | 2 |
3 files changed, 2 insertions, 3 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 3f2d7c92ea8..f99fdd27aed 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -62,6 +62,7 @@ class User < ActiveRecord::Base has_many :assigned_issues, class_name: "Issue", foreign_key: :assignee_id, dependent: :destroy has_many :assigned_merge_requests, class_name: "MergeRequest", foreign_key: :assignee_id, dependent: :destroy + validates :name, presence: true validates :bio, length: { within: 0..255 } validates :extern_uid, allow_blank: true, uniqueness: {scope: :provider} validates :projects_limit, presence: true, numericality: {greater_than_or_equal_to: 0} diff --git a/doc/api/users.md b/doc/api/users.md index c116144d91e..e5674ab8463 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -75,7 +75,7 @@ POST /users Parameters: + `email` (required) - Email + `password` (required) - Password -+ `name` - Name ++ `name` (required) - Name + `skype` - Skype ID + `linkedin` - Linkedin + `twitter` - Twitter account diff --git a/lib/api/users.rb b/lib/api/users.rb index cad99fd9f7b..140c20f6bd2 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -101,8 +101,6 @@ module Gitlab key = current_user.keys.find params[:id] key.delete end - - end end end |