diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /app/services/notification_service.rb | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) | |
download | gitlab-ce-6e4e1050d9dba2b7b2523fdd1768823ab85feef4.tar.gz |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'app/services/notification_service.rb')
-rw-r--r-- | app/services/notification_service.rb | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb index a4e935a8cf5..909a0033d12 100644 --- a/app/services/notification_service.rb +++ b/app/services/notification_service.rb @@ -66,6 +66,13 @@ class NotificationService mailer.access_token_about_to_expire_email(user).deliver_later end + # Notify the user when at least one of their personal access tokens has expired today + def access_token_expired(user) + return unless user.can?(:receive_notifications) + + mailer.access_token_expired_email(user).deliver_later + end + # Notify a user when a previously unknown IP or device is used to # sign in to their account def unknown_sign_in(user, ip, time) @@ -424,8 +431,8 @@ class NotificationService end def project_was_moved(project, old_path_with_namespace) - recipients = project.private? ? project.team.members_in_project_and_ancestors : project.team.members - recipients = notifiable_users(recipients, :mention, project: project) + recipients = project_moved_recipients(project) + recipients = notifiable_users(recipients, :custom, custom_action: :moved_project, project: project) recipients.each do |recipient| mailer.project_was_moved_email( @@ -705,6 +712,14 @@ class NotificationService recipients end + def project_moved_recipients(project) + finder = MembersFinder.new(project, nil, params: { + active_without_invites_and_requests: true, + owners_and_maintainers: true + }) + finder.execute.preload_user_and_notification_settings.map(&:user) + end + def project_maintainers_recipients(target, action:) NotificationRecipients::BuildService.build_project_maintainers_recipients(target, action: action) end |