summaryrefslogtreecommitdiff
path: root/app/mailers/abuse_report_mailer.rb
blob: 1bf7deec5425ab6122390061bea0226087cf2103 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

class AbuseReportMailer < ApplicationMailer
  layout 'empty_mailer'

  helper EmailsHelper

  def notify(abuse_report_id)
    return unless deliverable?

    @abuse_report = AbuseReport.find(abuse_report_id)

    mail_with_locale(
      to: Gitlab::CurrentSettings.abuse_notification_email,
      subject: "#{@abuse_report.user.name} (#{@abuse_report.user.username}) was reported for abuse"
    )
  end

  private

  def deliverable?
    Gitlab::CurrentSettings.abuse_notification_email.present?
  end
end