0
0
Fork 0

Fix /settings/applications rejecting scopes parameter (#33798)

This commit is contained in:
Claire 2025-02-02 22:11:32 +01:00 committed by GitHub
parent f79b96a5ef
commit cf820b2eca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 7 deletions

View file

@ -2,7 +2,6 @@
class Settings::ApplicationsController < Settings::BaseController
before_action :set_application, only: [:show, :update, :destroy, :regenerate]
before_action :prepare_scopes, only: [:create, :update]
def index
@applications = current_user.applications.order(id: :desc).page(params[:page])
@ -61,11 +60,9 @@ class Settings::ApplicationsController < Settings::BaseController
def application_params
params
.expect(doorkeeper_application: [:name, :redirect_uri, :scopes, :website])
end
def prepare_scopes
scopes = application_params.fetch(:doorkeeper_application, {}).fetch(:scopes, nil)
params[:doorkeeper_application][:scopes] = scopes.join(' ') if scopes.is_a? Array
.expect(doorkeeper_application: [:name, :redirect_uri, :website, scopes: []])
.tap do |params|
params[:scopes] = params[:scopes]&.join(' ')
end
end
end