mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
ability to email without footer
This commit is contained in:
parent
6da092aee7
commit
5450ab4e83
2 changed files with 20 additions and 3 deletions
|
@ -19,8 +19,21 @@ describe EmailWorker do
|
|||
mail.to.first.must_equal 'to@example.com'
|
||||
mail.subject.must_equal 'Hello World'
|
||||
body = mail.body.to_s
|
||||
puts body
|
||||
body.must_match /testing/
|
||||
body.must_match /unsubscribe/
|
||||
end
|
||||
|
||||
it 'sends an email without a footer' do
|
||||
worker = EmailWorker.new
|
||||
worker.perform({
|
||||
'no_footer' => true,
|
||||
'from' => 'from@example.com',
|
||||
'to' => 'to@example.com',
|
||||
'subject' => 'Hello World',
|
||||
'body' => 'testing'
|
||||
})
|
||||
body = Mail::TestMailer.deliveries.first.body.to_s
|
||||
body.must_match /testing/
|
||||
body.wont_match /unsubscribe/
|
||||
end
|
||||
end
|
|
@ -5,7 +5,11 @@ class EmailWorker
|
|||
def perform(args={})
|
||||
unsubscribe_token = Site.email_unsubscribe_token args['to']
|
||||
|
||||
if args['no_footer']
|
||||
footer = ''
|
||||
else
|
||||
footer = "\n\n---\nYou are receiving this email because you have a Neocities site. If you would like to subscribe from Neocities emails, just visit this url:\nhttps://neocities.org/settings/unsubscribe_email?email=#{Rack::Utils.escape args['to']}&token=#{unsubscribe_token}"
|
||||
end
|
||||
|
||||
Mail.deliver do
|
||||
# TODO this is not doing UTF-8 properly.
|
||||
|
|
Loading…
Add table
Reference in a new issue