diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-23 12:09:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-23 12:09:29 +0300 |
commit | 04eb990a846ce03d41d155ab626c220a3e21a823 (patch) | |
tree | a78c9b38c87911866d0ed192da7b5466e6659054 /app/services/notification_recipients | |
parent | 2c9bd42a6707df8bb7ed66f26cc17df8f36a47fa (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/notification_recipients')
-rw-r--r-- | app/services/notification_recipients/builder/base.rb | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/app/services/notification_recipients/builder/base.rb b/app/services/notification_recipients/builder/base.rb index 0a7f25f1af3..3fabec29c0d 100644 --- a/app/services/notification_recipients/builder/base.rb +++ b/app/services/notification_recipients/builder/base.rb @@ -183,58 +183,6 @@ module NotificationRecipients add_recipients(target.subscribers(project), :subscription, NotificationReason::SUBSCRIBED) end - # rubocop: disable CodeReuse/ActiveRecord - def user_ids_notifiable_on(resource, notification_level = nil) - return [] unless resource - - scope = resource.notification_settings - - if notification_level - scope = scope.where(level: NotificationSetting.levels[notification_level]) - end - - scope.pluck(:user_id) - end - # rubocop: enable CodeReuse/ActiveRecord - - # Build a list of user_ids based on project notification settings - def select_project_members_ids(global_setting, user_ids_global_level_watch) - user_ids = user_ids_notifiable_on(project, :watch) - - # If project setting is global, add to watch list if global setting is watch - user_ids + (global_setting & user_ids_global_level_watch) - end - - # Build a list of user_ids based on group notification settings - def select_group_members_ids(group, project_members, global_setting, user_ids_global_level_watch) - uids = user_ids_notifiable_on(group, :watch) - - # Group setting is global, add to user_ids list if global setting is watch - uids + (global_setting & user_ids_global_level_watch) - project_members - end - - # rubocop: disable CodeReuse/ActiveRecord - def user_ids_with_global_level_watch(ids) - settings_with_global_level_of(:watch, ids).pluck(:user_id) - end - # rubocop: enable CodeReuse/ActiveRecord - - # rubocop: disable CodeReuse/ActiveRecord - def user_ids_with_global_level_custom(ids, action) - settings_with_global_level_of(:custom, ids).pluck(:user_id) - end - # rubocop: enable CodeReuse/ActiveRecord - - # rubocop: disable CodeReuse/ActiveRecord - def settings_with_global_level_of(level, ids) - NotificationSetting.where( - user_id: ids, - source_type: nil, - level: NotificationSetting.levels[level] - ) - end - # rubocop: enable CodeReuse/ActiveRecord - def add_labels_subscribers(labels: nil) return unless target.respond_to? :labels |