Skip to content

Commit

Permalink
CV2-3798: update mail logo for all mails templates
Browse files Browse the repository at this point in the history
  • Loading branch information
melsawy committed Oct 26, 2023
1 parent 1be9c91 commit 20e6014
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions app/mailers/application_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def mail(options={})
return if options[:to].blank?
options[:to] = [options[:to]].flatten.collect{ |to| to.gsub(/[\u200B-\u200D\uFEFF]/, '') }
@direction = ApplicationMailer.set_template_direction
attachments.inline['checklogo.png'] = File.read('public/images/checklogo.png')
@logo_url = attachments['checklogo.png'].url
super(options)
end

Expand Down
12 changes: 9 additions & 3 deletions app/mailers/devise_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ class DeviseMailer < Devise::Mailer
def confirmation_instructions(record, token, opts={})
@host = CheckConfig.get('checkdesk_base_url')
@client_host = CheckConfig.get('checkdesk_client')
@direction = ApplicationMailer.set_template_direction
self.set_direction_and_logo
opts[:subject] = I18n.t(:mail_account_confirmation, app_name: CheckConfig.get('app_name'))
super
end

def reset_password_instructions(record, token, opts={})
@host = CheckConfig.get('checkdesk_base_url')
@title = I18n.t("mails_notifications.reset_password.title")
@direction = ApplicationMailer.set_template_direction
self.set_direction_and_logo
opts[:subject] = I18n.t('devise.mailer.reset_password_instructions.subject', app_name: CheckConfig.get('app_name'))
super
end
Expand All @@ -29,10 +29,16 @@ def invitation_instructions(record, token, opts={})
@invited_type = @invited_text.blank? ? 'default' : 'custom'
@due_at = opts[:due_at]
@title = I18n.t("mails_notifications.invitation.title")
@direction = ApplicationMailer.set_template_direction
self.set_direction_and_logo
tu = record.team_users.where(team_id: @team.id).last
opts[:to] = tu.invitation_email unless tu.nil?
opts[:subject] = I18n.t(:'devise.mailer.invitation_instructions.subject', user: @invited_by, team: @team.name)
super
end

def set_direction_and_logo
@direction = ApplicationMailer.set_template_direction
attachments.inline['checklogo.png'] = File.read('public/images/checklogo.png')
@logo_url = attachments['checklogo.png'].url
end
end
3 changes: 0 additions & 3 deletions app/mailers/feed_invitation_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ def notify(record)
@recipient = record.email
@user = record.user
@feed = record.feed
@direction = ApplicationMailer.set_template_direction
@due_at = record.created_at + CheckConfig.get('feed_invitation_due_to', 30).to_i.days
subject = I18n.t("mails_notifications.feed_invitation.subject", user: @user.name, feed: @feed.name)
attachments.inline['check_logo.png'] = File.read("#{Rails.root}/public/images/check.svg")
@logo_url = attachments['check_logo.png'].url
Rails.logger.info "Sending a feed invitation e-mail to #{@recipient}"
mail(to: @recipient, email_type: 'feed_invitation', subject: subject)
end
Expand Down
Binary file added public/images/checklogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 20e6014

Please sign in to comment.