]> cat aescling's git repositories - mastodon.git/commitdiff
Guarantee Subscription service first account has proper URL details (#4732)
authorJames <james.vogon@gmail.com>
Thu, 31 Aug 2017 13:44:00 +0000 (06:44 -0700)
committerEugen Rochko <eugen@zeonfederated.com>
Thu, 31 Aug 2017 13:44:00 +0000 (15:44 +0200)
* Guarantee Subscription service first account has proper URL details

Subscription Service potentially could break if the first user suspended
themselves, creating a situation where the urls that populate throughout
subscription service's PuSH request would cause the remote API to throw 503 errors.

Guaranteeing that the first account picked is not suspended prevents this problem.

* Fix style issue

app/services/subscribe_service.rb

index 5617f98f4e884b4d10c2720feb15ab1ce3ef8744..bfa7ff8c8e83b35a7027fd771a008f9b09717c09 100644 (file)
@@ -42,7 +42,7 @@ class SubscribeService < BaseService
   end
 
   def some_local_account
-    @some_local_account ||= Account.local.first
+    @some_local_account ||= Account.local.where(suspended: false).first
   end
 
   # Any response in the 3xx or 4xx range, except for 429 (rate limit)