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/user.rb')
-rw-r--r--app/models/user.rb20
1 files changed, 13 insertions, 7 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 26d47de4f00..8aae4441852 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -239,6 +239,8 @@ class User < ApplicationRecord
has_many :timelogs
+ has_many :resource_label_events, dependent: :nullify # rubocop:disable Cop/ActiveRecordDependent
+
#
# Validations
#
@@ -941,7 +943,7 @@ class User < ApplicationRecord
end
def two_factor_u2f_enabled?
- return false if Feature.enabled?(:webauthn, default_enabled: :yaml)
+ return false if Feature.enabled?(:webauthn)
if u2f_registrations.loaded?
u2f_registrations.any?
@@ -955,7 +957,7 @@ class User < ApplicationRecord
end
def two_factor_webauthn_enabled?
- return false unless Feature.enabled?(:webauthn, default_enabled: :yaml)
+ return false unless Feature.enabled?(:webauthn)
(webauthn_registrations.loaded? && webauthn_registrations.any?) || (!webauthn_registrations.loaded? && webauthn_registrations.exists?)
end
@@ -1583,7 +1585,7 @@ class User < ApplicationRecord
end
def manageable_groups(include_groups_with_developer_maintainer_access: false)
- owned_and_maintainer_group_hierarchy = if Feature.enabled?(:linear_user_manageable_groups, self, default_enabled: :yaml)
+ owned_and_maintainer_group_hierarchy = if Feature.enabled?(:linear_user_manageable_groups, self)
owned_or_maintainers_groups.self_and_descendants
else
Gitlab::ObjectHierarchy.new(owned_or_maintainers_groups).base_and_descendants
@@ -1673,7 +1675,7 @@ class User < ApplicationRecord
def ci_owned_runners_cross_joins_fix_enabled?
strong_memoize(:ci_owned_runners_cross_joins_fix_enabled) do
- Feature.enabled?(:ci_owned_runners_cross_joins_fix, self, default_enabled: :yaml)
+ Feature.enabled?(:ci_owned_runners_cross_joins_fix, self)
end
end
@@ -1735,7 +1737,7 @@ class User < ApplicationRecord
end
def attention_requested_open_merge_requests_count(force: false)
- if Feature.enabled?(:uncached_mr_attention_requests_count, self, default_enabled: :yaml)
+ if Feature.enabled?(:uncached_mr_attention_requests_count, self)
MergeRequestsFinder.new(self, attention: self.username, state: 'opened', non_archived: true).execute.count
else
Rails.cache.fetch(attention_request_cache_key, force: force, expires_in: COUNT_CACHE_VALIDITY_PERIOD) do
@@ -2070,6 +2072,10 @@ class User < ApplicationRecord
end
end
+ def mr_attention_requests_enabled?
+ Feature.enabled?(:mr_attention_requests, self)
+ end
+
protected
# override, from Devise::Validatable
@@ -2313,7 +2319,7 @@ class User < ApplicationRecord
# to avoid querying descendants since they are already covered
# by ancestor namespaces. If the FF is not available fallback to
# inefficient search: https://gitlab.com/gitlab-org/gitlab/-/issues/336436
- unless Feature.enabled?(:use_traversal_ids, default_enabled: :yaml)
+ unless Feature.enabled?(:use_traversal_ids)
return Ci::NamespaceMirror.contains_any_of_namespaces(search_members.pluck(:source_id))
end
@@ -2322,7 +2328,7 @@ class User < ApplicationRecord
.shortest_traversal_ids_prefixes
# Use efficient btree index to perform search
- if Feature.enabled?(:ci_owned_runners_unnest_index, self, default_enabled: :yaml)
+ if Feature.enabled?(:ci_owned_runners_unnest_index, self)
Ci::NamespaceMirror.contains_traversal_ids(traversal_ids)
else
Ci::NamespaceMirror.contains_any_of_namespaces(traversal_ids.map(&:last))