Skip to content
Snippets Groups Projects
Commit 7057ebe4 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets Committed by Wes Gurney
Browse files

Fix setting default values for user

parent bddb24eb
No related branches found
No related tags found
1 merge request!4954Add support to configure webhook_timeout in gitlab.yaml
Loading
Loading
@@ -200,17 +200,18 @@ class User < ActiveRecord::Base
end
 
def build_user(attrs = {}, options= {})
user = User.new(defaults.merge(attrs), options)
# if not as: :admin force default settings
user.with_defaults unless options[:as] == :admin
user
if options[:as] == :admin
User.new(defaults.merge(attrs.symbolize_keys), options)
else
User.new(attrs, options).with_defaults
end
end
 
def defaults
{
projects_limit: Gitlab.config.gitlab.default_projects_limit,
can_create_group: Gitlab.config.gitlab.default_can_create_group,
theme_id: Gitlab::Theme::BASIC
theme_id: Gitlab::Theme::MARS
}
end
end
Loading
Loading
@@ -384,8 +385,10 @@ class User < ActiveRecord::Base
end
 
def with_defaults
User.defaults.each do |k,v|
self.send("#{k}=",v)
User.defaults.each do |k, v|
self.send("#{k}=", v)
end
self
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment