1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Move to x namespace

This commit is contained in:
Matt Jankowski 2024-06-11 10:35:18 -04:00
parent 74af68e8a8
commit 78e3b77765
9 changed files with 24 additions and 24 deletions

View file

@ -79,7 +79,7 @@ class ApplicationController < ActionController::Base
end
def after_sign_out_path_for(_resource_or_scope)
if Rails.configuration.omniauth.only && Rails.configuration.omniauth.oidc_enabled
if Rails.configuration.x.omniauth.only && Rails.configuration.x.omniauth.oidc_enabled
'/auth/auth/openid_connect/logout'
else
new_user_session_path

View file

@ -11,7 +11,7 @@ module WebAppControllerConcern
end
def skip_csrf_meta_tags?
!(ENV['ONE_CLICK_SSO_LOGIN'] == 'true' && Rails.configuration.omniauth.only && Devise.omniauth_providers.length == 1) && current_user.nil?
!(ENV['ONE_CLICK_SSO_LOGIN'] == 'true' && Rails.configuration.x.omniauth.only && Devise.omniauth_providers.length == 1) && current_user.nil?
end
def set_app_body_class

View file

@ -49,7 +49,7 @@ module ApplicationHelper
end
def omniauth_only?
Rails.configuration.omniauth.only
Rails.configuration.x.omniauth.only
end
def link_to_login(name = nil, html_options = nil, &block)

View file

@ -12,7 +12,7 @@ module RegistrationHelper
end
def omniauth_only?
Rails.configuration.omniauth.only
Rails.configuration.x.omniauth.only
end
def ip_blocked?(remote_ip)

View file

@ -125,6 +125,6 @@ class InitialStateSerializer < ActiveModel::Serializer
end
def sso_redirect
"/auth/auth/#{Devise.omniauth_providers[0]}" if ENV['ONE_CLICK_SSO_LOGIN'] == 'true' && Rails.configuration.omniauth.only && Devise.omniauth_providers.length == 1
"/auth/auth/#{Devise.omniauth_providers[0]}" if ENV['ONE_CLICK_SSO_LOGIN'] == 'true' && Rails.configuration.x.omniauth.only && Devise.omniauth_providers.length == 1
end
end

View file

@ -113,7 +113,7 @@ module Mastodon
end
# Load config/omniauth.yml settings
config.omniauth = config_for(:omniauth)
config.x.omniauth = config_for(:omniauth)
config.to_prepare do
Doorkeeper::AuthorizationsController.layout 'modal'

View file

@ -10,26 +10,26 @@ end
Devise.setup do |config|
# CAS strategy
if Rails.configuration.omniauth.cas_enabled
if Rails.configuration.x.omniauth.cas_enabled
config.omniauth(
:cas,
Rails.configuration.omniauth.cas
Rails.configuration.x.omniauth.cas
)
end
# SAML strategy
if Rails.configuration.omniauth.saml_enabled
if Rails.configuration.x.omniauth.saml_enabled
config.omniauth(
:saml,
Rails.configuration.omniauth.saml
Rails.configuration.x.omniauth.saml
)
end
# OpenID Connect Strategy
if Rails.configuration.omniauth.oidc_enabled
if Rails.configuration.x.omniauth.oidc_enabled
config.omniauth(
:openid_connect,
Rails.configuration.omniauth.oidc
Rails.configuration.x.omniauth.oidc
)
end
end

View file

@ -88,10 +88,10 @@ describe ApplicationHelper do
context 'when in omniauth only mode' do
around do |example|
original = Rails.configuration.omniauth.only
Rails.configuration.omniauth.only = true
original = Rails.configuration.x.omniauth.only
Rails.configuration.x.omniauth.only = true
example.run
Rails.configuration.omniauth.only = original
Rails.configuration.x.omniauth.only = original
end
it 'redirects to joinmastodon site' do
@ -109,10 +109,10 @@ describe ApplicationHelper do
describe 'omniauth_only?' do
context 'when configuration is set to true' do
around do |example|
original = Rails.configuration.omniauth.only
Rails.configuration.omniauth.only = true
original = Rails.configuration.x.omniauth.only
Rails.configuration.x.omniauth.only = true
example.run
Rails.configuration.omniauth.only = original
Rails.configuration.x.omniauth.only = original
end
it 'returns true' do
@ -122,10 +122,10 @@ describe ApplicationHelper do
context 'when configuration is false' do
around do |example|
original = Rails.configuration.omniauth.only
Rails.configuration.omniauth.only = false
original = Rails.configuration.x.omniauth.only
Rails.configuration.x.omniauth.only = false
example.run
Rails.configuration.omniauth.only = original
Rails.configuration.x.omniauth.only = original
end
it 'returns false' do

View file

@ -129,15 +129,15 @@ describe 'OmniAuth callbacks' do
end
end
describe '#openid_connect', if: Rails.configuration.omniauth.oidc_enabled && Rails.configuration.omniauth.oidc[:scope].present? do
describe '#openid_connect', if: Rails.configuration.x.omniauth.oidc_enabled && Rails.configuration.x.omniauth.oidc[:scope].present? do
include_examples 'omniauth provider callbacks', :openid_connect
end
describe '#cas', if: Rails.configuration.omniauth.cas_enabled do
describe '#cas', if: Rails.configuration.x.omniauth.cas_enabled do
include_examples 'omniauth provider callbacks', :cas
end
describe '#saml', if: Rails.configuration.omniauth.saml_enabled do
describe '#saml', if: Rails.configuration.x.omniauth.saml_enabled do
include_examples 'omniauth provider callbacks', :saml
end
end