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.rb18
1 files changed, 4 insertions, 14 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index c4e867ab571..4034677509f 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -271,6 +271,7 @@ class User < MainClusterwide::ApplicationRecord
has_many :bulk_imports
has_many :custom_attributes, class_name: 'UserCustomAttribute'
+ has_one :trusted_with_spam_attribute, -> { UserCustomAttribute.trusted_with_spam }, class_name: 'UserCustomAttribute'
has_many :callouts, class_name: 'Users::Callout'
has_many :group_callouts, class_name: 'Users::GroupCallout'
has_many :project_callouts, class_name: 'Users::ProjectCallout'
@@ -306,6 +307,7 @@ class User < MainClusterwide::ApplicationRecord
has_many :awarded_user_achievements, class_name: 'Achievements::UserAchievement', foreign_key: 'awarded_by_user_id', inverse_of: :awarded_by_user
has_many :revoked_user_achievements, class_name: 'Achievements::UserAchievement', foreign_key: 'revoked_by_user_id', inverse_of: :revoked_by_user
has_many :achievements, through: :user_achievements, class_name: 'Achievements::Achievement', inverse_of: :users
+ has_many :vscode_settings, class_name: 'VsCode::Settings::VsCodeSetting', inverse_of: :user
#
# Validations
@@ -1234,10 +1236,6 @@ class User < MainClusterwide::ApplicationRecord
authorized_projects(Gitlab::Access::REPORTER).non_archived.with_issues_enabled
end
- def preloaded_member_roles_for_projects(projects)
- # overridden in EE
- end
-
# rubocop: disable CodeReuse/ServiceClass
def require_ssh_key?
count = Users::KeysCountService.new(self).count
@@ -2226,8 +2224,8 @@ class User < MainClusterwide::ApplicationRecord
}
end
- def allow_possible_spam?
- custom_attributes.by_key(UserCustomAttribute::ALLOW_POSSIBLE_SPAM).exists?
+ def trusted?
+ trusted_with_spam_attribute.present?
end
def namespace_commit_email_for_namespace(namespace)
@@ -2511,14 +2509,6 @@ class User < MainClusterwide::ApplicationRecord
def ci_namespace_mirrors_for_group_members(level)
search_members = group_members.where('access_level >= ?', level)
- # This reduces searched prefixes to only shortest ones
- # 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)
- return Ci::NamespaceMirror.contains_any_of_namespaces(search_members.pluck(:source_id))
- end
-
traversal_ids = Group.joins(:all_group_members)
.merge(search_members)
.shortest_traversal_ids_prefixes