diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /app/models/group.rb | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'app/models/group.rb')
-rw-r--r-- | app/models/group.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/app/models/group.rb b/app/models/group.rb index 1e7308499a0..f6b45a755e4 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -80,7 +80,7 @@ class Group < Namespace # debian_distributions and associated component_files must be destroyed by ruby code in order to properly remove carrierwave uploads has_many :debian_distributions, class_name: 'Packages::Debian::GroupDistribution', dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent - delegate :prevent_sharing_groups_outside_hierarchy, to: :namespace_settings + delegate :prevent_sharing_groups_outside_hierarchy, :new_user_signups_cap, to: :namespace_settings accepts_nested_attributes_for :variables, allow_destroy: true @@ -158,7 +158,7 @@ class Group < Namespace if current_scope.joins_values.include?(:shared_projects) joins('INNER JOIN namespaces project_namespace ON project_namespace.id = projects.namespace_id') .where(project_namespace: { share_with_group_lock: false }) - .select("projects.id AS project_id, LEAST(project_group_links.group_access, members.access_level) AS access_level") + .select("projects.id AS project_id", "LEAST(project_group_links.group_access, members.access_level) AS access_level") else super end @@ -296,7 +296,7 @@ class Group < Namespace end def add_users(users, access_level, current_user: nil, expires_at: nil) - Members::Groups::CreatorService.add_users( # rubocop:todo CodeReuse/ServiceClass + Members::Groups::CreatorService.add_users( # rubocop:disable CodeReuse/ServiceClass self, users, access_level, @@ -306,7 +306,7 @@ class Group < Namespace end def add_user(user, access_level, current_user: nil, expires_at: nil, ldap: false) - Members::Groups::CreatorService.new(self, # rubocop:todo CodeReuse/ServiceClass + Members::Groups::CreatorService.new(self, # rubocop:disable CodeReuse/ServiceClass user, access_level, current_user: current_user, @@ -463,7 +463,7 @@ class Group < Namespace id end - group_hierarchy_members = GroupMember.where(source_id: source_ids) + group_hierarchy_members = GroupMember.where(source_id: source_ids).select(*GroupMember.cached_column_list) GroupMember.from_union([group_hierarchy_members, members_from_self_and_ancestor_group_shares]).authorizable @@ -481,6 +481,7 @@ class Group < Namespace group_hierarchy_members = GroupMember.active_without_invites_and_requests .non_minimal_access .where(source_id: source_ids) + .select(*GroupMember.cached_column_list) GroupMember.from_union([group_hierarchy_members, members_from_self_and_ancestor_group_shares]) @@ -729,6 +730,10 @@ class Group < Namespace end # rubocop: enable CodeReuse/ServiceClass + def timelogs + Timelog.in_group(self) + end + private def max_member_access(user_ids) |