From a302e56f9a06b67cdf2184a278d99f9e65a67fca Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 29 Dec 2016 20:33:26 +0100 Subject: Add API for retrieving favourites --- app/services/favourite_service.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/services') 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 -- cgit