mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-14 08:19:05 +00:00
Merge commit 'ca41a95872545502dbc6bae6f7237ee20acc38ee' into glitch-soc/merge-upstream
Conflicts: - `spec/helpers/theme_helper_spec.rb`: Conflict due to glitch-soc's different theming system. Adapted upstream changes to glitch-soc's theming system.
This commit is contained in:
@@ -50,6 +50,10 @@ class Api::BaseController < ApplicationController
|
||||
nil
|
||||
end
|
||||
|
||||
def require_client_credentials!
|
||||
render json: { error: 'This method requires an client credentials authentication' }, status: 403 if doorkeeper_token.resource_owner_id.present?
|
||||
end
|
||||
|
||||
def require_authenticated_user!
|
||||
render json: { error: 'This method requires an authenticated user' }, status: 401 unless current_user
|
||||
end
|
||||
|
||||
@@ -10,6 +10,7 @@ class Api::V1::AccountsController < Api::BaseController
|
||||
before_action -> { doorkeeper_authorize! :write, :'write:accounts' }, only: [:create]
|
||||
|
||||
before_action :require_user!, except: [:index, :show, :create]
|
||||
before_action :require_client_credentials!, only: [:create]
|
||||
before_action :set_account, except: [:index, :create]
|
||||
before_action :set_accounts, only: [:index]
|
||||
before_action :check_account_approval, except: [:index, :create]
|
||||
|
||||
Reference in New Issue
Block a user