Respect feature settings submitted via api

This commit is contained in:
Dmitriy Zaporozhets 2013-04-26 16:25:46 +03:00
parent 42dc33e9dd
commit bffa1e6575

View file

@ -8,7 +8,18 @@ module Projects
# get namespace id
namespace_id = params.delete(:namespace_id)
@project = Project.new(params)
# Load default feature settings
default_features = Gitlab.config.gitlab.default_projects_features
default_opts = {
issues_enabled: default_features.issues,
wiki_enabled: default_features.wiki,
wall_enabled: default_features.wall,
snippets_enabled: default_features.snippets,
merge_requests_enabled: default_features.merge_requests
}
@project = Project.new(default_opts.merge(params))
# Parametrize path for project
#
@ -32,13 +43,6 @@ module Projects
@project.namespace_id = current_user.namespace_id
end
# Disable less important features by default
@project.issues_enabled = Gitlab.config.gitlab.default_projects_features.issues
@project.wiki_enabled = Gitlab.config.gitlab.default_projects_features.wiki
@project.wall_enabled = Gitlab.config.gitlab.default_projects_features.wall
@project.snippets_enabled = Gitlab.config.gitlab.default_projects_features.snippets
@project.merge_requests_enabled = Gitlab.config.gitlab.default_projects_features.merge_requests
@project.creator = current_user
# Import project from cloneable resource