mirror of
https://github.com/mastodon/mastodon.git
synced 2025-09-06 01:41:08 +00:00
Move layout
setup for OAuth views to controllers (#35176)
This commit is contained in:
parent
392eaf1010
commit
8285194451
|
@ -6,6 +6,8 @@ class OAuth::AuthorizationsController < Doorkeeper::AuthorizationsController
|
||||||
before_action :store_current_location
|
before_action :store_current_location
|
||||||
before_action :authenticate_resource_owner!
|
before_action :authenticate_resource_owner!
|
||||||
|
|
||||||
|
layout 'modal'
|
||||||
|
|
||||||
content_security_policy do |p|
|
content_security_policy do |p|
|
||||||
p.form_action(false)
|
p.form_action(false)
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,6 +11,8 @@ class OAuth::AuthorizedApplicationsController < Doorkeeper::AuthorizedApplicatio
|
||||||
|
|
||||||
skip_before_action :require_functional!
|
skip_before_action :require_functional!
|
||||||
|
|
||||||
|
layout 'admin'
|
||||||
|
|
||||||
include Localized
|
include Localized
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
|
|
@ -115,8 +115,6 @@ module Mastodon
|
||||||
end
|
end
|
||||||
|
|
||||||
config.to_prepare do
|
config.to_prepare do
|
||||||
Doorkeeper::AuthorizationsController.layout 'modal'
|
|
||||||
Doorkeeper::AuthorizedApplicationsController.layout 'admin'
|
|
||||||
Doorkeeper::Application.include ApplicationExtension
|
Doorkeeper::Application.include ApplicationExtension
|
||||||
Doorkeeper::AccessGrant.include AccessGrantExtension
|
Doorkeeper::AccessGrant.include AccessGrantExtension
|
||||||
Doorkeeper::AccessToken.include AccessTokenExtension
|
Doorkeeper::AccessToken.include AccessTokenExtension
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe OAuth::AuthorizationsController do
|
RSpec.describe OAuth::AuthorizationsController do
|
||||||
|
render_views
|
||||||
|
|
||||||
let(:app) { Doorkeeper::Application.create!(name: 'test', redirect_uri: 'http://localhost/', scopes: 'read') }
|
let(:app) { Doorkeeper::Application.create!(name: 'test', redirect_uri: 'http://localhost/', scopes: 'read') }
|
||||||
|
|
||||||
describe 'GET #new' do
|
describe 'GET #new' do
|
||||||
|
@ -24,6 +26,8 @@ RSpec.describe OAuth::AuthorizationsController do
|
||||||
.to have_http_status(200)
|
.to have_http_status(200)
|
||||||
expect(response.headers['Cache-Control'])
|
expect(response.headers['Cache-Control'])
|
||||||
.to include('private, no-store')
|
.to include('private, no-store')
|
||||||
|
expect(response.parsed_body.at('body.modal-layout'))
|
||||||
|
.to be_present
|
||||||
expect(controller.stored_location_for(:user))
|
expect(controller.stored_location_for(:user))
|
||||||
.to eq authorize_path_for(app)
|
.to eq authorize_path_for(app)
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,6 +21,8 @@ RSpec.describe OAuth::AuthorizedApplicationsController do
|
||||||
.to have_http_status(200)
|
.to have_http_status(200)
|
||||||
expect(response.headers['Cache-Control'])
|
expect(response.headers['Cache-Control'])
|
||||||
.to include('private, no-store')
|
.to include('private, no-store')
|
||||||
|
expect(response.parsed_body.at('body.admin'))
|
||||||
|
.to be_present
|
||||||
expect(controller.stored_location_for(:user))
|
expect(controller.stored_location_for(:user))
|
||||||
.to eq '/oauth/authorized_applications'
|
.to eq '/oauth/authorized_applications'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user