Fix RemoteFollow behavior (#3868)
* Invalid acct is an error. not "2 errors". * Empty input should be different error from invalid acctlolsob-rspec
parent
baa248a801
commit
1d2eba7a84
|
@ -5,11 +5,15 @@ class RemoteFollow
|
||||||
|
|
||||||
attr_accessor :acct, :addressable_template
|
attr_accessor :acct, :addressable_template
|
||||||
|
|
||||||
|
validates :acct, presence: true
|
||||||
|
|
||||||
def initialize(attrs = {})
|
def initialize(attrs = {})
|
||||||
@acct = attrs[:acct].gsub(/\A@/, '').strip unless attrs[:acct].nil?
|
@acct = attrs[:acct].gsub(/\A@/, '').strip unless attrs[:acct].nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
def valid?
|
def valid?
|
||||||
|
return false unless super
|
||||||
|
|
||||||
populate_template
|
populate_template
|
||||||
errors.empty?
|
errors.empty?
|
||||||
end
|
end
|
||||||
|
@ -39,7 +43,6 @@ class RemoteFollow
|
||||||
def acct_resource
|
def acct_resource
|
||||||
@_acct_resource ||= Goldfinger.finger("acct:#{acct}")
|
@_acct_resource ||= Goldfinger.finger("acct:#{acct}")
|
||||||
rescue Goldfinger::Error
|
rescue Goldfinger::Error
|
||||||
missing_resource_error
|
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue