From b943baa42a5365bd6377022223f66db9af58da33 Mon Sep 17 00:00:00 2001 From: Manoj MJ Date: Fri, 30 Aug 2019 21:30:51 +0000 Subject: Limit access request email to 10 most recently active owners/maintainers This change limits the number of emails for new access requests notifications to 10 most recently active owners/maintainers --- app/models/project.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/models/project.rb') diff --git a/app/models/project.rb b/app/models/project.rb index 8f568a5b840..a6d203f1e72 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -55,6 +55,8 @@ class Project < ApplicationRecord VALID_MIRROR_PORTS = [22, 80, 443].freeze VALID_MIRROR_PROTOCOLS = %w(http https ssh git).freeze + ACCESS_REQUEST_APPROVERS_TO_BE_NOTIFIED_LIMIT = 10 + SORTING_PREFERENCE_FIELD = :projects_sort cache_markdown_field :description, pipeline: :description @@ -2193,6 +2195,10 @@ class Project < ApplicationRecord pool_repository.present? end + def access_request_approvers_to_be_notified + members.maintainers.order_recent_sign_in.limit(ACCESS_REQUEST_APPROVERS_TO_BE_NOTIFIED_LIMIT) + end + private def merge_requests_allowing_collaboration(source_branch = nil) -- cgit v1.2.1