From 5133458d30e0f9e8cc131f1a9613745beeaf5f75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonne=20Ha=C3=9F?= Date: Sat, 20 Sep 2014 04:05:57 +0200 Subject: [PATCH] Start converting IDN emails --- Changelog.md | 1 + app/mailers/notification_mailers/base.rb | 2 +- spec/mailers/notifier_spec.rb | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 5cbb40ed5..810003230 100644 --- a/Changelog.md +++ b/Changelog.md @@ -49,6 +49,7 @@ The default for including jQuery from a CDN has changed. If you want to continue * Handle long URLs and titles in OpenGraph descriptions [#5208](https://github.com/diaspora/diaspora/pull/5208) * Fix deformed getting started popover [#5227](https://github.com/diaspora/diaspora/pull/5227) * Use correct locale for invitation subject [#5232](https://github.com/diaspora/diaspora/pull/5232) +* Initial support for IDN emails ## Features * Don't pull jQuery from a CDN by default [#5105](https://github.com/diaspora/diaspora/pull/5105) diff --git a/app/mailers/notification_mailers/base.rb b/app/mailers/notification_mailers/base.rb index ec2950bfb..086228b06 100644 --- a/app/mailers/notification_mailers/base.rb +++ b/app/mailers/notification_mailers/base.rb @@ -23,7 +23,7 @@ module NotificationMailers end def name_and_address(name, email) - address = Mail::Address.new email + address = Mail::Address.new Addressable::IDNA.to_ascii(email) address.display_name = name address.format end diff --git a/spec/mailers/notifier_spec.rb b/spec/mailers/notifier_spec.rb index 327880780..c5296b5c6 100644 --- a/spec/mailers/notifier_spec.rb +++ b/spec/mailers/notifier_spec.rb @@ -326,4 +326,14 @@ describe Notifier, :type => :mailer do expect(mail.body.encoded).to match "

#Welcome to bureaucracy!

" end end + + describe "base" do + it "handles idn addresses" do + # user = FactoryGirl.create(:user, email: "ŧoo@ŧexample.com") + bob.update_attribute(:email, "ŧoo@ŧexample.com") + expect { + Notifier.started_sharing(bob.id, person.id) + }.to_not raise_error + end + end end