about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-12-29 20:33:26 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-12-29 20:33:26 +0100
commita302e56f9a06b67cdf2184a278d99f9e65a67fca (patch)
tree557382faf818eddf518e286059e8482e881deb94 /app/services
parent49834a6e7f06301a5bcc17b8771ed4513622b6a8 (diff)
Add API for retrieving favourites
Diffstat (limited to 'app/services')
-rw-r--r--app/services/favourite_service.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/services/favourite_service.rb b/app/services/favourite_service.rb
index 5c04cfee4..d5fbd29e9 100644
--- a/app/services/favourite_service.rb
+++ b/app/services/favourite_service.rb
@@ -6,12 +6,14 @@ class FavouriteService < BaseService
   # @param [Status] status
   # @return [Favourite]
   def call(account, status)
+    raise Mastodon::NotPermitted unless status.permitted?(account)
+
     favourite = Favourite.create!(account: account, status: status)
 
     Pubsubhubbub::DistributionWorker.perform_async(favourite.stream_entry.id)
 
     if status.local?
-      NotifyService.new.call(status.account, favourite)
+      NotifyService.new.call(favourite.status.account, favourite)
     else
       NotificationWorker.perform_async(favourite.stream_entry.id, status.account_id)
     end