diff --git a/app/mailers/notifier.rb b/app/mailers/notifier.rb index ce10e1825..8cb7d8b10 100644 --- a/app/mailers/notifier.rb +++ b/app/mailers/notifier.rb @@ -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 diff --git a/app/views/layouts/notifier.html.haml b/app/views/layouts/notifier.html.haml index ef334cedf..c9691911f 100644 --- a/app/views/layouts/notifier.html.haml +++ b/app/views/layouts/notifier.html.haml @@ -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') diff --git a/app/views/layouts/notifier.text.haml b/app/views/layouts/notifier.text.haml new file mode 100644 index 000000000..c4c25579e --- /dev/null +++ b/app/views/layouts/notifier.text.haml @@ -0,0 +1,3 @@ +!= yield +!= t('notifier.manage_your_email_settings') +!= "#{ AppConfig[:pod_uri].host}/users/#{@receiver.id}/edit" diff --git a/app/views/notifier/single_admin.html.haml b/app/views/notifier/single_admin.html.haml index 764d3028b..6edcf78b3 100644 --- a/app/views/notifier/single_admin.html.haml +++ b/app/views/notifier/single_admin.html.haml @@ -1,5 +1,5 @@ %p - = t('notifier.hello', :name => @recipient.username) + = t('notifier.hello', :name => @receiver.username) %p = @string diff --git a/app/views/notifier/single_admin.text.haml b/app/views/notifier/single_admin.text.haml index ec60ca115..e70dc3f4b 100644 --- a/app/views/notifier/single_admin.text.haml +++ b/app/views/notifier/single_admin.text.haml @@ -1,4 +1,4 @@ -!= t('notifier.hello', :name => @recipient.username) +!= t('notifier.hello', :name => @receiver.username) != @string diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 6df94b3ae..b3d8698a0 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -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" diff --git a/spec/mailers/notifier_spec.rb b/spec/mailers/notifier_spec.rb index 997cdb697..e81ec4642 100644 --- a/spec/mailers/notifier_spec.rb +++ b/spec/mailers/notifier_spec.rb @@ -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