add a plaintext layout for emails, and include a link to change your email settings in the emails
This commit is contained in:
parent
557b5393c2
commit
a036a8035f
7 changed files with 17 additions and 5 deletions
|
|
@ -1,6 +1,5 @@
|
|||
class Notifier < ActionMailer::Base
|
||||
helper :application
|
||||
|
||||
default :from => AppConfig[:smtp_sender_address]
|
||||
|
||||
ATTACHMENT = File.read("#{Rails.root}/public/images/logo_caps.png")
|
||||
|
|
@ -15,10 +14,10 @@ class Notifier < ActionMailer::Base
|
|||
end
|
||||
|
||||
def single_admin(string, recipient)
|
||||
@recipient = recipient
|
||||
@receiver = recipient
|
||||
@string = string.html_safe
|
||||
attachments.inline['logo_caps.png'] = ATTACHMENT
|
||||
mail(:to => @recipient.email,
|
||||
mail(:to => @receiver.email,
|
||||
:subject => I18n.t('notifier.single_admin.subject'), :host => AppConfig[:pod_uri].host)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -8,3 +8,5 @@
|
|||
= image_tag attachments['logo_caps.png'].url, :alt => "DIASPORA"
|
||||
#container
|
||||
= yield
|
||||
%a{:href => "#{ AppConfig[:pod_uri].host}/users/#{@receiver.id}/edit"}
|
||||
= t('notifier.manage_your_email_settings')
|
||||
|
|
|
|||
3
app/views/layouts/notifier.text.haml
Normal file
3
app/views/layouts/notifier.text.haml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
!= yield
|
||||
!= t('notifier.manage_your_email_settings')
|
||||
!= "#{ AppConfig[:pod_uri].host}/users/#{@receiver.id}/edit"
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
%p
|
||||
= t('notifier.hello', :name => @recipient.username)
|
||||
= t('notifier.hello', :name => @receiver.username)
|
||||
%p
|
||||
= @string
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
!= t('notifier.hello', :name => @recipient.username)
|
||||
!= t('notifier.hello', :name => @receiver.username)
|
||||
|
||||
!= @string
|
||||
|
||||
|
|
|
|||
|
|
@ -300,6 +300,7 @@ en:
|
|||
love: "love,"
|
||||
thanks: "Thanks,"
|
||||
diaspora: "the diaspora email robot"
|
||||
manage_your_email_settings: "manage your email settings"
|
||||
single_admin:
|
||||
subject: "A message about your Diaspora account:"
|
||||
admin: "Your Diaspora administrator"
|
||||
|
|
|
|||
|
|
@ -43,6 +43,13 @@ describe Notifier do
|
|||
mail.body.encoded.should match /Welcome to bureaucracy!/
|
||||
mail.body.encoded.should match /#{user.username}/
|
||||
end
|
||||
|
||||
it 'has the layout' do
|
||||
|
||||
mail = Notifier.single_admin("Welcome to bureaucracy!", user)
|
||||
puts mail.body.encoded
|
||||
mail.body.encoded.should match /manage your email settings/
|
||||
end
|
||||
end
|
||||
|
||||
describe ".new_request" do
|
||||
|
|
|
|||
Loading…
Reference in a new issue