debian-mirror-gitlab/app/mailers/emails/releases.rb

34 lines
770 B
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# 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
)
2022-01-26 12:08:38 +05:30
@recipient = User.find(user_id)
2019-12-21 20:55:43 +05:30
mail(
2022-01-26 12:08:38 +05:30
to: @recipient.notification_email_for(@project.group),
2019-12-21 20:55:43 +05:30
subject: subject(release_email_subject)
)
end
private
def release_email_subject
2019-12-26 22:10:19 +05:30
release_info =
if @release.name == @release.tag
@release.tag
else
[@release.name, @release.tag].select(&:presence).join(' - ')
end
2019-12-21 20:55:43 +05:30
"New release: #{release_info}"
end
end
end