From c216d3a885e8b494faf38f0b92a9ec204d76709e Mon Sep 17 00:00:00 2001 From: Claire Date: Sat, 9 Apr 2022 20:11:06 +0200 Subject: [PATCH] Fix crash in alias settings page (#18004) (cherry picked from commit dc503472477000597f2ff1b6a5c37e8ac4dd2d8c) --- app/models/account_alias.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/account_alias.rb b/app/models/account_alias.rb index 3d659142a..b421c66e2 100644 --- a/app/models/account_alias.rb +++ b/app/models/account_alias.rb @@ -28,6 +28,11 @@ class AccountAlias < ApplicationRecord super(val.start_with?('@') ? val[1..-1] : val) end + def pretty_acct + username, domain = acct.split('@') + domain.nil? ? username : "#{username}@#{Addressable::IDNA.to_unicode(domain)}" + end + private def set_uri