summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorManoj MJ <mmj@gitlab.com>2019-08-30 21:30:51 +0000
committerMayra Cabrera <mcabrera@gitlab.com>2019-08-30 21:30:51 +0000
commitb943baa42a5365bd6377022223f66db9af58da33 (patch)
tree60baf4cdcce1176d6a92ede78000a42e3d46d288 /app/models/project.rb
parent663b7bb4771f3261d7451b6e1d74c778fd0e3589 (diff)
downloadgitlab-ce-b943baa42a5365bd6377022223f66db9af58da33.tar.gz
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
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb6
1 files changed, 6 insertions, 0 deletions
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)