From 509c18eb139ead0d2e2f02f580ef04b28d874f48 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 8 Sep 2016 02:40:51 +0200 Subject: Fix local follows, 404 in logs --- app/services/follow_remote_account_service.rb | 2 +- app/services/follow_service.rb | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'app/services') diff --git a/app/services/follow_remote_account_service.rb b/app/services/follow_remote_account_service.rb index f05668420..c4330d7cf 100644 --- a/app/services/follow_remote_account_service.rb +++ b/app/services/follow_remote_account_service.rb @@ -8,7 +8,7 @@ class FollowRemoteAccountService < BaseService def call(uri, subscribe = true) username, domain = uri.split('@') - return Account.find_local(username) if domain == Rails.configuration.x.local_domain + return Account.find_local(username) if domain == Rails.configuration.x.local_domain || domain.nil? account = Account.find_remote(username, domain) diff --git a/app/services/follow_service.rb b/app/services/follow_service.rb index 06bbfa8f0..e4a4bfcd3 100644 --- a/app/services/follow_service.rb +++ b/app/services/follow_service.rb @@ -8,7 +8,13 @@ class FollowService < BaseService return nil if target_account.nil? follow = source_account.follow!(target_account) - NotificationWorker.perform_async(follow.stream_entry.id, target_account.id) + + if target_account.local? + NotificationMailer.follow(target_account, source_account).deliver_later + else + NotificationWorker.perform_async(follow.stream_entry.id, target_account.id) + end + source_account.ping!(account_url(source_account, format: 'atom'), [Rails.configuration.x.hub_url]) follow end -- cgit