Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-03-02 11:22:44 +0300
committerToon Claes <toon@gitlab.com>2017-03-02 18:31:22 +0300
commitc3b1cb71f0726bd9cd3916507337650e6546141f (patch)
treed5076999de9f53bf25c9a5a4e4af69c3d524bd83 /app/models/application_setting.rb
parenta3fdd6acd27f5aa98f13e7a0083d0c3208003ccb (diff)
Override setters so it also accepts string visibility levels
Override the `ApplicationSetting` default visibility_level setters so they accept strings & integers for the levels.
Diffstat (limited to 'app/models/application_setting.rb')
-rw-r--r--app/models/application_setting.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index d6d17195bd3..255e8c4ff78 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -278,6 +278,22 @@ class ApplicationSetting < ActiveRecord::Base
self.repository_storages = [value]
end
+ def default_project_visibility=(level)
+ super(Gitlab::VisibilityLevel.level_value(level))
+ end
+
+ def default_snippet_visibility=(level)
+ super(Gitlab::VisibilityLevel.level_value(level))
+ end
+
+ def default_group_visibility=(level)
+ super(Gitlab::VisibilityLevel.level_value(level))
+ end
+
+ def restricted_visibility_levels=(levels)
+ super(levels.map { |level| Gitlab::VisibilityLevel.level_value(level) })
+ end
+
# Choose one of the available repository storage options. Currently all have
# equal weighting.
def pick_repository_storage