]> cat aescling's git repositories - mastodon.git/commitdiff
Change conditional to avoid nil into string error in sidekiq (#5987)
authorRenato "Lond" Cerqueira <renato@lond.com.br>
Tue, 12 Dec 2017 14:11:13 +0000 (15:11 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Tue, 12 Dec 2017 14:11:13 +0000 (15:11 +0100)
* Change conditional to avoid nil into string error in sidekiq
When obtaining information about users with mastodon in a different
subdomain, sidekiq was giving out a 'no implicit conversion of nil into String'

* Use presence instead of blank? with ternary.
Following suggestion on PR

app/services/fetch_remote_status_service.rb

index 9c009335b6e967a2654199cbc0ea7d21d1e6e70b..9c3008035d5431e07d1ef0f8c86fdcec0e378e96 100644 (file)
@@ -40,6 +40,6 @@ class FetchRemoteStatusService < BaseService
   end
 
   def confirmed_domain?(domain, account)
-    account.domain.nil? || domain.casecmp(account.domain).zero? || domain.casecmp(Addressable::URI.parse(account.remote_url || account.uri).normalized_host).zero?
+    account.domain.nil? || domain.casecmp(account.domain).zero? || domain.casecmp(Addressable::URI.parse(account.remote_url.presence || account.uri).normalized_host).zero?
   end
 end