diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-12-29 20:33:26 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-12-29 20:33:26 +0100 |
commit | a302e56f9a06b67cdf2184a278d99f9e65a67fca (patch) | |
tree | 557382faf818eddf518e286059e8482e881deb94 /app/services | |
parent | 49834a6e7f06301a5bcc17b8771ed4513622b6a8 (diff) |
Add API for retrieving favourites
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/favourite_service.rb | 4 |
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 |