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:
Diffstat (limited to 'app/models/namespace_setting.rb')
-rw-r--r--app/models/namespace_setting.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/models/namespace_setting.rb b/app/models/namespace_setting.rb
index 595e34821af..6a87fba57ac 100644
--- a/app/models/namespace_setting.rb
+++ b/app/models/namespace_setting.rb
@@ -4,6 +4,11 @@ class NamespaceSetting < ApplicationRecord
include CascadingNamespaceSettingAttribute
include Sanitizable
include ChronicDurationAttribute
+ include IgnorableColumns
+
+ ignore_columns %i[exclude_from_free_user_cap include_for_free_user_cap_preview],
+ remove_with: '15.5',
+ remove_after: '2022-09-23'
cascading_attr :delayed_project_removal
@@ -53,8 +58,18 @@ class NamespaceSetting < ApplicationRecord
namespace.root_ancestor.prevent_sharing_groups_outside_hierarchy
end
+ def show_diff_preview_in_email?
+ return show_diff_preview_in_email unless namespace.has_parent?
+
+ all_ancestors_allow_diff_preview_in_email?
+ end
+
private
+ def all_ancestors_allow_diff_preview_in_email?
+ !self.class.where(namespace_id: namespace.self_and_ancestors, show_diff_preview_in_email: false).exists?
+ end
+
def normalize_default_branch_name
self.default_branch_name = default_branch_name.presence
end