summaryrefslogtreecommitdiff
path: root/app/mailers/emails/releases.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/mailers/emails/releases.rb')
-rw-r--r--app/mailers/emails/releases.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/app/mailers/emails/releases.rb b/app/mailers/emails/releases.rb
new file mode 100644
index 00000000000..137858d31e8
--- /dev/null
+++ b/app/mailers/emails/releases.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+module Emails
+ module Releases
+ def new_release_email(user_id, release, reason = nil)
+ @release = release
+ @project = @release.project
+ @target_url = namespace_project_releases_url(
+ namespace_id: @project.namespace,
+ project_id: @project
+ )
+
+ user = User.find(user_id)
+
+ mail(
+ to: user.notification_email_for(@project.group),
+ subject: subject(release_email_subject)
+ )
+ end
+
+ private
+
+ def release_email_subject
+ release_info = [@release.name, @release.tag].select(&:presence).join(' - ')
+ "New release: #{release_info}"
+ end
+ end
+end