diff --git a/app/models/oauth_client.rb b/app/models/oauth_client.rb index 693dfdf9e75..d79bb046413 100644 --- a/app/models/oauth_client.rb +++ b/app/models/oauth_client.rb @@ -30,6 +30,6 @@ class OAuthClient < ApplicationRecord belongs_to :integration, polymorphic: true def redirect_uri - File.join(OpenProject::Application.root_url, 'oauth_clients', client_id, 'callback') + File.join(Rails.application.root_url, 'oauth_clients', client_id, 'callback') end end diff --git a/app/views/user_mailer/activation_limit_reached.html.erb b/app/views/user_mailer/activation_limit_reached.html.erb index 01ae55aafee..a27811db74d 100644 --- a/app/views/user_mailer/activation_limit_reached.html.erb +++ b/app/views/user_mailer/activation_limit_reached.html.erb @@ -29,7 +29,7 @@ See COPYRIGHT and LICENSE files for more details.

<% mail_link = "#{@email}" %> - <% host = OpenProject::Application.root_url %> + <% host = Rails.application.root_url %> <% host_link = "#{Setting.app_title}" %> <%= t("mail_user_activation_limit_reached.message", email: mail_link, host: host_link).html_safe %>

diff --git a/app/views/user_mailer/activation_limit_reached.text.erb b/app/views/user_mailer/activation_limit_reached.text.erb index 51690e8a193..c91cf4090dc 100644 --- a/app/views/user_mailer/activation_limit_reached.text.erb +++ b/app/views/user_mailer/activation_limit_reached.text.erb @@ -27,7 +27,7 @@ See COPYRIGHT and LICENSE files for more details. ++#%> -<%= t("mail_user_activation_limit_reached.message", email: @email, host: OpenProject::Application.root_url) %> +<%= t("mail_user_activation_limit_reached.message", email: @email, host: Rails.application.root_url) %> <%= t("mail_user_activation_limit_reached.steps.label") %> - <%= t("mail_user_activation_limit_reached.steps.a").sub(link_regex, OpenProject::Enterprise.upgrade_url) %> diff --git a/config.ru b/config.ru index cc50ba9210c..3f4f6b1679b 100644 --- a/config.ru +++ b/config.ru @@ -36,5 +36,5 @@ map (subdir || '/') do use Rack::Protection::JsonCsrf use Rack::Protection::FrameOptions - run OpenProject::Application + run Rails.application end diff --git a/config/environment.rb b/config/environment.rb index ce95ee0114d..d968dea66d9 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -30,4 +30,4 @@ require_relative 'application' # Initialize the Rails application. -OpenProject::Application.initialize! +Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index 8f58fe343ed..19fc0c3dbd6 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -28,7 +28,7 @@ require 'active_support/core_ext/integer/time' -OpenProject::Application.configure do +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded any time diff --git a/config/environments/production.rb b/config/environments/production.rb index 8ea59ed0351..5c525fa135b 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -28,7 +28,7 @@ require 'active_support/core_ext/integer/time' -OpenProject::Application.configure do +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. diff --git a/config/environments/test.rb b/config/environments/test.rb index 73e27b7c98a..9dea7b7c1b2 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -33,7 +33,7 @@ require 'active_support/core_ext/integer/time' # your test database is "scratch space" for the test suite and is wiped # and recreated between test runs. Don't rely on the data there! -OpenProject::Application.configure do +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Access to rack session diff --git a/config/initializers/appsignal.rb b/config/initializers/appsignal.rb index 1706ad12e2e..4447db874e4 100644 --- a/config/initializers/appsignal.rb +++ b/config/initializers/appsignal.rb @@ -3,7 +3,7 @@ require_relative '../../lib_static/open_project/appsignal' if OpenProject::Appsignal.enabled? require 'appsignal' - OpenProject::Application.configure do |app| + Rails.application.configure do |app| config = { active: true, name: ENV.fetch('APPSIGNAL_NAME'), diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 6968bc52f2c..c0c37cdd056 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1,6 +1,6 @@ # Be sure to restart your server when you modify this file. -OpenProject::Application.configure do +Rails.application.configure do # Version of your assets, change this if you want to expire all your assets. # config.assets.version = "1.0" diff --git a/config/initializers/authentication_stages.rb b/config/initializers/authentication_stages.rb index 88af7bc7c76..05485787d63 100644 --- a/config/initializers/authentication_stages.rb +++ b/config/initializers/authentication_stages.rb @@ -1,4 +1,4 @@ -OpenProject::Application.configure do |application| +Rails.application.configure do |application| # Ensure stage is entered when reloading in dev mode application.config.to_prepare do OpenProject::Authentication::Stage diff --git a/config/initializers/bullet.rb b/config/initializers/bullet.rb index a45558be655..ac7a612a0e3 100644 --- a/config/initializers/bullet.rb +++ b/config/initializers/bullet.rb @@ -27,7 +27,7 @@ #++ if defined?(Bullet) && Rails.env.development? - OpenProject::Application.configure do + Rails.application.configure do config.after_initialize do Bullet.enable = true # Bullet.alert = true diff --git a/config/initializers/cronjobs.rb b/config/initializers/cronjobs.rb index 086811b26f7..6dda0beb89e 100644 --- a/config/initializers/cronjobs.rb +++ b/config/initializers/cronjobs.rb @@ -1,6 +1,6 @@ # Register "Cron-like jobs" -OpenProject::Application.configure do |application| +Rails.application.configure do |application| application.config.to_prepare do Cron::CronJob.register! Cron::ClearOldSessionsJob, Cron::ClearTmpCacheJob, diff --git a/config/initializers/doorkeeper.rb b/config/initializers/doorkeeper.rb index 7994c3760b3..1f20f2c6fb8 100644 --- a/config/initializers/doorkeeper.rb +++ b/config/initializers/doorkeeper.rb @@ -193,7 +193,7 @@ Doorkeeper.configure do # realm "Doorkeeper" end -OpenProject::Application.configure do |application| +Rails.application.configure do |application| application.config.to_prepare do # Requiring some classes of Doorkeeper ourselves which for whatever reasons are # no longer loaded for us now that we use zeitwerk diff --git a/config/initializers/export_formats.rb b/config/initializers/export_formats.rb index 949498288ed..aa88a141b4f 100644 --- a/config/initializers/export_formats.rb +++ b/config/initializers/export_formats.rb @@ -1,4 +1,4 @@ -OpenProject::Application.configure do |application| +Rails.application.configure do |application| application.config.to_prepare do Exports::Register.register do list WorkPackage, WorkPackage::Exports::CSV diff --git a/config/initializers/grape_logging.rb b/config/initializers/grape_logging.rb index d0c44bc23f3..015303792fe 100644 --- a/config/initializers/grape_logging.rb +++ b/config/initializers/grape_logging.rb @@ -1,4 +1,4 @@ -OpenProject::Application.configure do +Rails.application.configure do config.after_initialize do ActiveSupport::Notifications.subscribe('openproject_grape_logger') do |_, _, _, _, payload| time = payload[:time] diff --git a/config/initializers/log_slow_sql_queries.rb b/config/initializers/log_slow_sql_queries.rb index eadc105cb40..6f77128350c 100644 --- a/config/initializers/log_slow_sql_queries.rb +++ b/config/initializers/log_slow_sql_queries.rb @@ -1,4 +1,4 @@ -OpenProject::Application.configure do +Rails.application.configure do config.after_initialize do next if Rails.env.test? diff --git a/config/initializers/lookbook.rb b/config/initializers/lookbook.rb index ce028cc203a..7278a9d4b67 100644 --- a/config/initializers/lookbook.rb +++ b/config/initializers/lookbook.rb @@ -1,4 +1,4 @@ -OpenProject::Application.configure do +Rails.application.configure do next unless OpenProject::Configuration.lookbook_enabled? require 'factory_bot' diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index af35f8a1b70..594349b46b9 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -38,7 +38,7 @@ session_options = { path: relative_url_root } -OpenProject::Application.config.session_store :active_record_store, **session_options +Rails.application.config.session_store :active_record_store, **session_options Rails.application.reloader.to_prepare do ## diff --git a/config/initializers/view_component.rb b/config/initializers/view_component.rb index fc77b9d988f..dbdaa2a1743 100644 --- a/config/initializers/view_component.rb +++ b/config/initializers/view_component.rb @@ -1,4 +1,4 @@ -OpenProject::Application.configure do +Rails.application.configure do config.view_component.generate.preview_path = Rails.root.join("spec/components/previews").to_s config.view_component.preview_paths << Rails.root.join("spec/components/previews").to_s diff --git a/config/routes.rb b/config/routes.rb index e48a5f4073f..1b94aa3b4f0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -26,7 +26,7 @@ # See COPYRIGHT and LICENSE files for more details. #++ -OpenProject::Application.routes.draw do +Rails.application.routes.draw do root to: 'homescreen#index', as: 'home' rails_relative_url_root = OpenProject::Configuration['rails_relative_url_root'] || '' diff --git a/lib_static/open_project/feature_decisions.rb b/lib_static/open_project/feature_decisions.rb index 1a3ca370101..9e0e5506782 100644 --- a/lib_static/open_project/feature_decisions.rb +++ b/lib_static/open_project/feature_decisions.rb @@ -32,7 +32,7 @@ module OpenProject # # New feature flags can automatically be added by calling # - # OpenProject::Application.initializer 'set flag' do + # Rails.application.initializer 'set flag' do # OpenProject::FeatureDecisions.add :the_name_of_the_flag # end # diff --git a/modules/avatars/config/routes.rb b/modules/avatars/config/routes.rb index 60b4359036a..68dbc9272e5 100644 --- a/modules/avatars/config/routes.rb +++ b/modules/avatars/config/routes.rb @@ -1,4 +1,4 @@ -OpenProject::Application.routes.draw do +Rails.application.routes.draw do # Update my avatar scope 'my' do resource :avatar, controller: 'avatars/my_avatar', as: 'edit_my_avatar', only: %i[show update destroy] diff --git a/modules/backlogs/config/routes.rb b/modules/backlogs/config/routes.rb index 4472488a0c5..bbf91c0a55e 100644 --- a/modules/backlogs/config/routes.rb +++ b/modules/backlogs/config/routes.rb @@ -26,7 +26,7 @@ # See COPYRIGHT and LICENSE files for more details. #++ -OpenProject::Application.routes.draw do +Rails.application.routes.draw do scope '', as: 'backlogs' do scope 'projects/:project_id', as: 'project' do resources :backlogs, controller: :rb_master_backlogs, only: :index diff --git a/modules/bim/config/routes.rb b/modules/bim/config/routes.rb index e2d2528c102..be8a4a4b063 100644 --- a/modules/bim/config/routes.rb +++ b/modules/bim/config/routes.rb @@ -26,7 +26,7 @@ # See COPYRIGHT and LICENSE files for more details. #++ -OpenProject::Application.routes.draw do +Rails.application.routes.draw do scope '', as: 'bcf' do mount Bim::Bcf::API::Root => '/api/bcf' diff --git a/modules/boards/config/routes.rb b/modules/boards/config/routes.rb index f4ad6eac07c..8a5e952698a 100644 --- a/modules/boards/config/routes.rb +++ b/modules/boards/config/routes.rb @@ -1,4 +1,4 @@ -OpenProject::Application.routes.draw do +Rails.application.routes.draw do resources :boards, controller: 'boards/boards', only: %i[index new create destroy], diff --git a/modules/budgets/config/routes.rb b/modules/budgets/config/routes.rb index 2519e288e4a..46a2e315d3b 100644 --- a/modules/budgets/config/routes.rb +++ b/modules/budgets/config/routes.rb @@ -26,7 +26,7 @@ # See COPYRIGHT and LICENSE files for more details. #++ -OpenProject::Application.routes.draw do +Rails.application.routes.draw do scope 'projects/:project_id', as: 'projects' do resources :budgets, only: %i[new create index] do match :update_labor_budget_item, on: :collection, via: %i[get post] diff --git a/modules/calendar/config/routes.rb b/modules/calendar/config/routes.rb index 4f9a7307c19..404d3d17a0a 100644 --- a/modules/calendar/config/routes.rb +++ b/modules/calendar/config/routes.rb @@ -1,4 +1,4 @@ -OpenProject::Application.routes.draw do +Rails.application.routes.draw do scope 'projects/:project_id', as: 'project' do resources :calendars, controller: 'calendar/calendars', diff --git a/modules/costs/config/routes.rb b/modules/costs/config/routes.rb index 9b688ba32f5..56ccfe3e607 100644 --- a/modules/costs/config/routes.rb +++ b/modules/costs/config/routes.rb @@ -26,7 +26,7 @@ # See COPYRIGHT and LICENSE files for more details. #++ -OpenProject::Application.routes.draw do +Rails.application.routes.draw do scope 'projects/:project_id', as: 'projects' do resources :cost_entries, controller: 'costlog', only: %i[new create] diff --git a/modules/dashboards/config/routes.rb b/modules/dashboards/config/routes.rb index 5cad745cbb7..1f17b0e4336 100644 --- a/modules/dashboards/config/routes.rb +++ b/modules/dashboards/config/routes.rb @@ -1,3 +1,3 @@ -OpenProject::Application.routes.draw do +Rails.application.routes.draw do get '/projects/:project_id/dashboards', to: 'dashboards/dashboards#show', as: :project_dashboards end diff --git a/modules/documents/config/routes.rb b/modules/documents/config/routes.rb index f2029a562ca..7c83e25fbb4 100644 --- a/modules/documents/config/routes.rb +++ b/modules/documents/config/routes.rb @@ -26,7 +26,7 @@ # See COPYRIGHT and LICENSE files for more details. #++ -OpenProject::Application.routes.draw do +Rails.application.routes.draw do resources :projects, only: [] do resources :documents, only: %i[create new index] end diff --git a/modules/gantt/config/routes.rb b/modules/gantt/config/routes.rb index 68eb3b11c25..ec21074b0af 100644 --- a/modules/gantt/config/routes.rb +++ b/modules/gantt/config/routes.rb @@ -1,4 +1,4 @@ -OpenProject::Application.routes.draw do +Rails.application.routes.draw do scope 'projects/:project_id', as: 'project' do resources :gantt, controller: 'gantt/gantt', only: [:index] do collection do diff --git a/modules/job_status/config/routes.rb b/modules/job_status/config/routes.rb index 30626a7a021..c2d6d1a97c0 100644 --- a/modules/job_status/config/routes.rb +++ b/modules/job_status/config/routes.rb @@ -1,4 +1,4 @@ -OpenProject::Application.routes.draw do +Rails.application.routes.draw do get '/job_statuses/:job_uuid', to: 'angular#empty_layout', as: 'job_status' diff --git a/modules/ldap_groups/config/routes.rb b/modules/ldap_groups/config/routes.rb index fd017d09e07..e4aec6a09d6 100644 --- a/modules/ldap_groups/config/routes.rb +++ b/modules/ldap_groups/config/routes.rb @@ -1,4 +1,4 @@ -OpenProject::Application.routes.draw do +Rails.application.routes.draw do namespace 'ldap_groups' do resources :synchronized_filters, param: :ldap_filter_id, diff --git a/modules/meeting/config/routes.rb b/modules/meeting/config/routes.rb index 7bb7da09db6..5e373fb438d 100644 --- a/modules/meeting/config/routes.rb +++ b/modules/meeting/config/routes.rb @@ -26,7 +26,7 @@ # See COPYRIGHT and LICENSE files for more details. #++ -OpenProject::Application.routes.draw do +Rails.application.routes.draw do resources :projects, only: %i[] do resources :meetings, only: %i[index new create] end diff --git a/modules/my_page/config/routes.rb b/modules/my_page/config/routes.rb index 1a01b950758..a25a741b432 100644 --- a/modules/my_page/config/routes.rb +++ b/modules/my_page/config/routes.rb @@ -26,6 +26,6 @@ # See COPYRIGHT and LICENSE files for more details. #++ -OpenProject::Application.routes.draw do +Rails.application.routes.draw do get '/my/page', to: 'angular#empty_layout' end diff --git a/modules/overviews/config/routes.rb b/modules/overviews/config/routes.rb index 81d5c874867..ca6a4e5f15b 100644 --- a/modules/overviews/config/routes.rb +++ b/modules/overviews/config/routes.rb @@ -1,4 +1,4 @@ -OpenProject::Application.routes.draw do +Rails.application.routes.draw do get 'projects/:project_id', to: "overviews/overviews#show", as: :project_overview, diff --git a/modules/recaptcha/config/routes.rb b/modules/recaptcha/config/routes.rb index d4f7ddeb071..ba999384cf3 100644 --- a/modules/recaptcha/config/routes.rb +++ b/modules/recaptcha/config/routes.rb @@ -1,4 +1,4 @@ -OpenProject::Application::routes.draw do +Rails.application.routes.draw do namespace 'recaptcha' do get :settings, to: 'admin#show' post :settings, to: 'admin#update' diff --git a/modules/reporting/config/routes.rb b/modules/reporting/config/routes.rb index 4642ec9d192..81d826ae64b 100644 --- a/modules/reporting/config/routes.rb +++ b/modules/reporting/config/routes.rb @@ -26,7 +26,7 @@ # See COPYRIGHT and LICENSE files for more details. #++ -OpenProject::Application.routes.draw do +Rails.application.routes.draw do scope 'projects/:project_id' do resources :cost_reports, except: :create do collection do diff --git a/modules/storages/config/routes.rb b/modules/storages/config/routes.rb index 7f32a79a42f..8e02febd757 100644 --- a/modules/storages/config/routes.rb +++ b/modules/storages/config/routes.rb @@ -28,7 +28,7 @@ # See COPYRIGHT and LICENSE files for more details. #++ -OpenProject::Application.routes.draw do +Rails.application.routes.draw do namespace :admin do namespace :settings do resources :storages, controller: '/storages/admin/storages', except: [:show] do diff --git a/modules/team_planner/config/routes.rb b/modules/team_planner/config/routes.rb index 99e645405c9..8922404f2b9 100644 --- a/modules/team_planner/config/routes.rb +++ b/modules/team_planner/config/routes.rb @@ -1,4 +1,4 @@ -OpenProject::Application.routes.draw do +Rails.application.routes.draw do resources :team_planners, controller: 'team_planner/team_planner', only: %i[create] do diff --git a/modules/two_factor_authentication/config/routes.rb b/modules/two_factor_authentication/config/routes.rb index d2bedd4f765..ee878f269ea 100644 --- a/modules/two_factor_authentication/config/routes.rb +++ b/modules/two_factor_authentication/config/routes.rb @@ -1,4 +1,4 @@ -OpenProject::Application::routes.draw do +Rails.application.routes.draw do namespace 'two_factor_authentication' do get :request, to: 'authentication#request_otp' post :confirm, to: 'authentication#confirm_otp' diff --git a/modules/webhooks/config/routes.rb b/modules/webhooks/config/routes.rb index e87d20bee30..fd28b654c70 100644 --- a/modules/webhooks/config/routes.rb +++ b/modules/webhooks/config/routes.rb @@ -26,7 +26,7 @@ # See COPYRIGHT and LICENSE files for more details. #++ -OpenProject::Application.routes.draw do +Rails.application.routes.draw do namespace 'webhooks' do match ":hook_name", to: 'incoming/hooks#handle_hook', via: %i(get post) end diff --git a/spec/features/homescreen/index_spec.rb b/spec/features/homescreen/index_spec.rb index 2a20840dafe..e8ce67e7a5f 100644 --- a/spec/features/homescreen/index_spec.rb +++ b/spec/features/homescreen/index_spec.rb @@ -55,7 +55,7 @@ RSpec.describe 'Homescreen', 'index', :with_cuprite do login_as user visit root_url expect(page) - .to have_css("a[href=\"#{OpenProject::Application.root_url}/projects/public-project\"]") + .to have_css("a[href=\"#{Rails.application.root_url}/projects/public-project\"]") click_link "a link to the public project" expect(page).to have_current_path project_path(project) @@ -75,7 +75,7 @@ RSpec.describe 'Homescreen', 'index', :with_cuprite do visit root_url expect(page) - .to have_css("a[href=\"#{OpenProject::Application.root_url}/projects/public-project\"]") + .to have_css("a[href=\"#{Rails.application.root_url}/projects/public-project\"]") click_link "a link to the public project" expect(page).to have_current_path /#{Regexp.escape(project_path(project))}\/?$/ diff --git a/spec/lib/open_project/text_formatting/markdown/setting_variable_spec.rb b/spec/lib/open_project/text_formatting/markdown/setting_variable_spec.rb index 814d69ebd6b..ef30f4fcf40 100644 --- a/spec/lib/open_project/text_formatting/markdown/setting_variable_spec.rb +++ b/spec/lib/open_project/text_formatting/markdown/setting_variable_spec.rb @@ -57,15 +57,15 @@ RSpec.describe OpenProject::TextFormatting, Inline reference to variable setting: #{OpenProject::StaticRouting::UrlHelpers.host}

- Inline reference to base_url variable: #{OpenProject::Application.root_url} + Inline reference to base_url variable: #{Rails.application.root_url}

- Link with setting

- Saved and transformed link with setting

diff --git a/spec/requests/oauth_clients/ensure_connection_flow_spec.rb b/spec/requests/oauth_clients/ensure_connection_flow_spec.rb index d24834d8461..e913e4e9443 100644 --- a/spec/requests/oauth_clients/ensure_connection_flow_spec.rb +++ b/spec/requests/oauth_clients/ensure_connection_flow_spec.rb @@ -68,7 +68,8 @@ RSpec.describe "/oauth_clients/:oauth_client_id/ensure_connection endpoint", :we expect(last_response.status).to eq(302) expect(last_response.body).to eq( "You are being redirected." \ "" ) @@ -87,7 +88,8 @@ RSpec.describe "/oauth_clients/:oauth_client_id/ensure_connection endpoint", :we expect(last_response.status).to eq(302) expect(last_response.body).to eq( "You are being redirected." \ "" ) @@ -105,7 +107,8 @@ RSpec.describe "/oauth_clients/:oauth_client_id/ensure_connection endpoint", :we expect(last_response.status).to eq(302) expect(last_response.body).to eq( "You are being redirected." \ "" )