about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-12-26 21:52:03 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-12-26 21:52:03 +0100
commit2146ac91a004bad2a6c4dc1d01599a85515928f5 (patch)
tree0e65a4537c5c33f9e273d8646f1eded0eeb1e38c /app/services
parent3689c119f0ad8d523ab8deb3c2c8ed0a9c84db6e (diff)
Follow requests send e-mail notifications, but are excluded from notifications API
Better initial state for unlisted/nsfw toggles
Diffstat (limited to 'app/services')
-rw-r--r--app/services/follow_service.rb7
-rw-r--r--app/services/notify_service.rb5
2 files changed, 11 insertions, 1 deletions
diff --git a/app/services/follow_service.rb b/app/services/follow_service.rb
index a73ec344d..555f01b6d 100644
--- a/app/services/follow_service.rb
+++ b/app/services/follow_service.rb
@@ -20,7 +20,12 @@ class FollowService < BaseService
   private
 
   def request_follow(source_account, target_account)
-    FollowRequest.create!(account: source_account, target_account: target_account)
+    return unless target_account.local?
+
+    follow_request = FollowRequest.create!(account: source_account, target_account: target_account)
+    NotifyService.new.call(target_account, follow_request)
+
+    follow_request
   end
 
   def direct_follow(source_account, target_account)
diff --git a/app/services/notify_service.rb b/app/services/notify_service.rb
index 8263c4376..2fb1d3919 100644
--- a/app/services/notify_service.rb
+++ b/app/services/notify_service.rb
@@ -32,6 +32,10 @@ class NotifyService < BaseService
     false
   end
 
+  def blocked_follow_request?
+    false
+  end
+
   def blocked?
     blocked   = @recipient.suspended?                                                                                             # Skip if the recipient account is suspended anyway
     blocked ||= @recipient.id == @notification.from_account.id                                                                    # Skip for interactions with self
@@ -45,6 +49,7 @@ class NotifyService < BaseService
 
   def create_notification
     @notification.save!
+    return unless @notification.browserable?
     FeedManager.instance.broadcast(@recipient.id, type: 'notification', message: FeedManager.instance.inline_render(@recipient, 'api/v1/notifications/show', @notification))
   end