Extract authorization policy for viewing statuses (#3150)
This commit is contained in:
committed by
Eugen Rochko
parent
9a81be0d37
commit
3a2003ba86
@@ -1,12 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class FavouriteService < BaseService
|
||||
include Authorization
|
||||
|
||||
# Favourite a status and notify remote user
|
||||
# @param [Account] account
|
||||
# @param [Status] status
|
||||
# @return [Favourite]
|
||||
def call(account, status)
|
||||
raise Mastodon::NotPermittedError unless status.permitted?(account)
|
||||
authorize_with account, status, :show?
|
||||
|
||||
favourite = Favourite.create!(account: account, status: status)
|
||||
|
||||
|
Reference in New Issue
Block a user