about summary refs log tree commit diff
path: root/app/models/remote_follow.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-05-11 21:54:30 +0200
committerGitHub <noreply@github.com>2017-05-11 21:54:30 +0200
commit65f9db73b01012fd4944be9a56ba4a85407590aa (patch)
tree72f095f38349d88f829666875bc51e4c4497fc1f /app/models/remote_follow.rb
parenta822f7a05ac4337d45cfd930bd0d779eaf07ad57 (diff)
Fix #2027 - Accept own ID for remote follow with and without preceding @ (#2991)
* Fix #2027 - Accept own ID for remote follow with and without preceding @
Fix #2177 - Omit leading "acct:" in remote follow redirect template expansion

* Fix test
Diffstat (limited to 'app/models/remote_follow.rb')
-rw-r--r--app/models/remote_follow.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/remote_follow.rb b/app/models/remote_follow.rb
index c226cdb14..3da3ba0ae 100644
--- a/app/models/remote_follow.rb
+++ b/app/models/remote_follow.rb
@@ -6,7 +6,7 @@ class RemoteFollow
   attr_accessor :acct, :addressable_template
 
   def initialize(attrs = {})
-    @acct = attrs[:acct].strip unless attrs[:acct].nil?
+    @acct = attrs[:acct].gsub(/\A@/, '').strip unless attrs[:acct].nil?
   end
 
   def valid?
@@ -15,7 +15,7 @@ class RemoteFollow
   end
 
   def subscribe_address_for(account)
-    addressable_template.expand(uri: account.to_webfinger_s).to_s
+    addressable_template.expand(uri: account.local_username_and_domain).to_s
   end
 
   private