Commit 2dc97e53 authored by Nikola Milojevic's avatar Nikola Milojevic

Merge branch '345792-fj-use-linear-user-group-notifications-settings-ancestors' into 'master'

User linear version UserGroupNotificationSettingsFinder#execute

See merge request gitlab-org/gitlab!75645
parents cce3194c 9d4a6597
...@@ -7,15 +7,7 @@ class UserGroupNotificationSettingsFinder ...@@ -7,15 +7,7 @@ class UserGroupNotificationSettingsFinder
end end
def execute def execute
# rubocop: disable CodeReuse/ActiveRecord groups_with_ancestors = groups.self_and_ancestors
selected_groups = Group.where(id: groups.select(:id))
groups_with_ancestors = if Feature.enabled?(:linear_user_group_notification_settings_finder_ancestors_scopes, user, default_enabled: :yaml)
selected_groups.self_and_ancestors
else
Gitlab::ObjectHierarchy.new(selected_groups).base_and_ancestors
end
# rubocop: enable CodeReuse/ActiveRecord
@loaded_groups_with_ancestors = groups_with_ancestors.index_by(&:id) @loaded_groups_with_ancestors = groups_with_ancestors.index_by(&:id)
@loaded_notification_settings = user.notification_settings_for_groups(groups_with_ancestors).preload_source_route.index_by(&:source_id) @loaded_notification_settings = user.notification_settings_for_groups(groups_with_ancestors).preload_source_route.index_by(&:source_id)
......
---
name: linear_user_group_notification_settings_finder_ancestors_scopes
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/74606
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/345792
milestone: '14.6'
type: development
group: group::access
default_enabled: false
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment