mirror of
https://github.com/mastodon/mastodon.git
synced 2025-02-06 06:55:04 +00:00
Fix /settings/applications
rejecting scopes parameter (#33798)
Some checks failed
Check i18n / check-i18n (push) Waiting to run
Check formatting / lint (push) Waiting to run
Ruby Linting / lint (push) Waiting to run
Historical data migration test / test (14-alpine) (push) Waiting to run
Historical data migration test / test (15-alpine) (push) Waiting to run
Historical data migration test / test (16-alpine) (push) Waiting to run
Historical data migration test / test (17-alpine) (push) Waiting to run
Ruby Testing / build (production) (push) Waiting to run
Ruby Testing / build (test) (push) Waiting to run
Ruby Testing / test (.ruby-version) (push) Blocked by required conditions
Ruby Testing / test (3.2) (push) Blocked by required conditions
Ruby Testing / test (3.3) (push) Blocked by required conditions
Ruby Testing / Libvips tests (.ruby-version) (push) Blocked by required conditions
Ruby Testing / Libvips tests (3.2) (push) Blocked by required conditions
Ruby Testing / Libvips tests (3.3) (push) Blocked by required conditions
Ruby Testing / End to End testing (.ruby-version) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.2) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.3) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.10.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.3, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (ruby) (push) Has been cancelled
Some checks failed
Check i18n / check-i18n (push) Waiting to run
Check formatting / lint (push) Waiting to run
Ruby Linting / lint (push) Waiting to run
Historical data migration test / test (14-alpine) (push) Waiting to run
Historical data migration test / test (15-alpine) (push) Waiting to run
Historical data migration test / test (16-alpine) (push) Waiting to run
Historical data migration test / test (17-alpine) (push) Waiting to run
Ruby Testing / build (production) (push) Waiting to run
Ruby Testing / build (test) (push) Waiting to run
Ruby Testing / test (.ruby-version) (push) Blocked by required conditions
Ruby Testing / test (3.2) (push) Blocked by required conditions
Ruby Testing / test (3.3) (push) Blocked by required conditions
Ruby Testing / Libvips tests (.ruby-version) (push) Blocked by required conditions
Ruby Testing / Libvips tests (3.2) (push) Blocked by required conditions
Ruby Testing / Libvips tests (3.3) (push) Blocked by required conditions
Ruby Testing / End to End testing (.ruby-version) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.2) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.3) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.10.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.3, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (ruby) (push) Has been cancelled
This commit is contained in:
parent
f79b96a5ef
commit
cf820b2eca
|
@ -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
|
||||
|
|
|
@ -38,6 +38,9 @@ RSpec.describe 'Settings applications page' do
|
|||
expect(page)
|
||||
.to have_content(I18n.t('doorkeeper.applications.index.title'))
|
||||
.and have_content('My new app')
|
||||
.and have_content('read')
|
||||
.and have_content('write')
|
||||
.and have_content('follow')
|
||||
end
|
||||
|
||||
it 'does not save with invalid form values' do
|
||||
|
@ -73,10 +76,12 @@ RSpec.describe 'Settings applications page' do
|
|||
|
||||
fill_in form_app_name_label,
|
||||
with: 'My new app name with a new value'
|
||||
check 'push', id: :doorkeeper_application_scopes_push
|
||||
submit_form
|
||||
|
||||
expect(page)
|
||||
.to have_content('My new app name with a new value')
|
||||
.and have_checked_field('push', id: :doorkeeper_application_scopes_push)
|
||||
end
|
||||
|
||||
it 'does not update with wrong values' do
|
||||
|
|
Loading…
Reference in New Issue
Block a user