about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorunarist <m.unarist@gmail.com>2017-06-21 03:40:56 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-06-20 20:40:56 +0200
commita20cf3b64e93d764f1dfe88ecdb39f3fd4eefe03 (patch)
tree735483344db0013e7bee62274b0801c4bf341c1a /app
parent356df7ae6b6edfc600fbc532f32fbc46314e00a0 (diff)
Fix RemoteFollow behavior (#3868)
* Invalid acct is an error. not "2 errors".
* Empty input should be different error from invalid acct
Diffstat (limited to 'app')
-rw-r--r--app/models/remote_follow.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/remote_follow.rb b/app/models/remote_follow.rb
index 3da3ba0ae..8366d43c5 100644
--- a/app/models/remote_follow.rb
+++ b/app/models/remote_follow.rb
@@ -5,11 +5,15 @@ class RemoteFollow
 
   attr_accessor :acct, :addressable_template
 
+  validates :acct, presence: true
+
   def initialize(attrs = {})
     @acct = attrs[:acct].gsub(/\A@/, '').strip unless attrs[:acct].nil?
   end
 
   def valid?
+    return false unless super
+
     populate_template
     errors.empty?
   end
@@ -39,7 +43,6 @@ class RemoteFollow
   def acct_resource
     @_acct_resource ||= Goldfinger.finger("acct:#{acct}")
   rescue Goldfinger::Error
-    missing_resource_error
     nil
   end