mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-22 09:08:24 +00:00
Use find_or_initialize_by (#9504)
This commit is contained in:
parent
cf6ee4ff24
commit
351ed12b2f
|
@ -58,12 +58,7 @@ class Pubsubhubbub::SubscribeService < BaseService
|
|||
end
|
||||
|
||||
def locate_subscription
|
||||
subscription = Subscription.find_by(account: account, callback_url: callback)
|
||||
|
||||
if subscription.nil?
|
||||
subscription = Subscription.new(account: account, callback_url: callback)
|
||||
end
|
||||
|
||||
subscription = Subscription.find_or_initialize_by(account: account, callback_url: callback)
|
||||
subscription.domain = domain
|
||||
subscription.save!
|
||||
subscription
|
||||
|
|
Loading…
Reference in a new issue