]> cat aescling's git repositories - mastodon.git/commitdiff
Fix crash in alias settings page (#18004)
authorClaire <claire.github-309c@sitedethib.com>
Sat, 9 Apr 2022 18:11:06 +0000 (20:11 +0200)
committerkibigo! <1960844-kibigo@users.noreply.gitlab.com>
Tue, 12 Apr 2022 01:41:21 +0000 (01:41 +0000)
app/models/account_alias.rb

index 3d659142a05548022c60f04e72591c836cdecde3..b421c66e211df1cf10e782bd0cf6cf961b26ac15 100644 (file)
@@ -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