diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 08:43:02 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 08:43:02 +0000 |
commit | d9ab72d6080f594d0b3cae15f14b3ef2c6c638cb (patch) | |
tree | 2341ef426af70ad1e289c38036737e04b0aa5007 /app/models/group.rb | |
parent | d6e514dd13db8947884cd58fe2a9c2a063400a9b (diff) | |
download | gitlab-ce-d9ab72d6080f594d0b3cae15f14b3ef2c6c638cb.tar.gz |
Add latest changes from gitlab-org/gitlab@14-4-stable-eev14.4.0-rc42
Diffstat (limited to 'app/models/group.rb')
-rw-r--r-- | app/models/group.rb | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/app/models/group.rb b/app/models/group.rb index a667a908707..c5e119451e3 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -192,9 +192,15 @@ class Group < Namespace # Returns the ids of the passed group models where the `emails_disabled` # column is set to true anywhere in the ancestor hierarchy. def ids_with_disabled_email(groups) - innner_query = Gitlab::ObjectHierarchy - .new(Group.where('id = namespaces_with_emails_disabled.id')) - .base_and_ancestors + inner_groups = Group.where('id = namespaces_with_emails_disabled.id') + + inner_ancestors = if Feature.enabled?(:linear_group_ancestor_scopes, default_enabled: :yaml) + inner_groups.self_and_ancestors + else + Gitlab::ObjectHierarchy.new(inner_groups).base_and_ancestors + end + + inner_query = inner_ancestors .where(emails_disabled: true) .select('1') .limit(1) @@ -202,7 +208,7 @@ class Group < Namespace group_ids = Namespace .from('(SELECT * FROM namespaces) as namespaces_with_emails_disabled') .where(namespaces_with_emails_disabled: { id: groups }) - .where('EXISTS (?)', innner_query) + .where('EXISTS (?)', inner_query) .pluck(:id) Set.new(group_ids) @@ -701,9 +707,9 @@ class Group < Namespace raise ArgumentError unless SHARED_RUNNERS_SETTINGS.include?(state) case state - when 'disabled_and_unoverridable' then disable_shared_runners! # also disallows override - when 'disabled_with_override' then disable_shared_runners_and_allow_override! - when 'enabled' then enable_shared_runners! # set both to true + when SR_DISABLED_AND_UNOVERRIDABLE then disable_shared_runners! # also disallows override + when SR_DISABLED_WITH_OVERRIDE then disable_shared_runners_and_allow_override! + when SR_ENABLED then enable_shared_runners! # set both to true end end |