# frozen_string_literal: true

class ApplicationMailer < ActionMailer::Base
  default from: "TiDB Knowledge Base <#{ENV['MAILER_FROM'] || 'noreply@mail.asktug.com'}>"
  layout "mailer"

  def default_url_options
    locale = I18n.locale == I18n.default_locale ? nil : I18n.locale
    {
      locale: locale,
    }
  end

  def email_notifications?(user)
    return unless user
    return if Rails.env.development?
  end
end
