Extract authorization policy for viewing statuses (#3150)
This commit is contained in:
parent
9a81be0d37
commit
3a2003ba86
16 changed files with 155 additions and 80 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue