app/mailers/report_mailer.rb
# Create email to badge entry owner about their new badge status
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
# rubocop:disable Metrics/PerceivedComplexity
Create email to badge entry owner about their new badge status
rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
rubocop:disable Metrics/PerceivedComplexity
Create email to badge entry owner about their new badge status rubocop : disable Metrics / AbcSize Metrics / CyclomaticComplexity rubocop : disable Metrics / PerceivedComplexity
def email_owner(project, old_badge_level, new_badge_level, lost_level)
    return if project.nil? || project.id.nil? || project.user_id.nil?
    @project = project
    user = User.find(project.user_id)
    return if user.nil?
    return unless user.email?
    return unless user.email.include?('@')
    @project_info_url =
      project_url(@project, locale: user.preferred_locale.to_sym)
    @email_destination = user.email
    @new_level = new_badge_level
    @old_level = old_badge_level
    set_standard_headers
    I18n.with_locale(user.preferred_locale.to_sym) do
      mail(
        to: @email_destination,
        template_name: lost_level ? 'lost_level' : 'gained_level',
        subject: subject_for(
          old_badge_level, new_badge_level, lost_level
        ).strip
      )
    end
  end
def email_owner ( project , old_badge_level , new_badge_level , lost_level ) return if project . nil? || project . id . nil? || project . user_id . nil? @project = project user = User . find ( project . user_id ) return if user . nil? return unless user . email? return unless user . email . include? ( '@' ) @project_info_url = project_url ( @project , locale : user . preferred_locale . to_sym ) @email_destination = user . email @new_level = new_badge_level @old_level = old_badge_level set_standard_headers I18n . with_locale ( user . preferred_locale . to_sym ) do mail ( to : @email_destination , template_name : lost_level ? 'lost_level' : 'gained_level' , subject : subject_for ( old_badge_level , new_badge_level , lost_level ) . strip ) end end
Create email to badge entry owner about their new badge status
rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
rubocop:disable Metrics/PerceivedComplexity
Create email to badge entry owner about their new badge status rubocop : disable Metrics / AbcSize Metrics / CyclomaticComplexity rubocop : disable Metrics / PerceivedComplexity
project
<not_specific>
old_badge_level
<not_specific>
new_badge_level
<not_specific>
lost_level
<not_specific>