Use Rails.application instead of OpenProject::Application

This commit is contained in:
Dombi Attila
2023-12-16 13:11:05 +02:00
parent aec8707d29
commit ba16112745
46 changed files with 54 additions and 51 deletions
+1 -1
View File
@@ -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
@@ -29,7 +29,7 @@ See COPYRIGHT and LICENSE files for more details.
<p>
<% mail_link = "<a href=\"mailto:#{@email}\">#{@email}</a>" %>
<% host = OpenProject::Application.root_url %>
<% host = Rails.application.root_url %>
<% host_link = "<a href=\"#{host}\">#{Setting.app_title}</a>" %>
<%= t("mail_user_activation_limit_reached.message", email: mail_link, host: host_link).html_safe %>
</p>
@@ -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) %>
+1 -1
View File
@@ -36,5 +36,5 @@ map (subdir || '/') do
use Rack::Protection::JsonCsrf
use Rack::Protection::FrameOptions
run OpenProject::Application
run Rails.application
end
+1 -1
View File
@@ -30,4 +30,4 @@
require_relative 'application'
# Initialize the Rails application.
OpenProject::Application.initialize!
Rails.application.initialize!
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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'),
+1 -1
View File
@@ -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"
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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,
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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]
+1 -1
View File
@@ -1,4 +1,4 @@
OpenProject::Application.configure do
Rails.application.configure do
config.after_initialize do
next if Rails.env.test?
+1 -1
View File
@@ -1,4 +1,4 @@
OpenProject::Application.configure do
Rails.application.configure do
next unless OpenProject::Configuration.lookbook_enabled?
require 'factory_bot'
+1 -1
View File
@@ -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
##
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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'] || ''
+1 -1
View File
@@ -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
#
+1 -1
View File
@@ -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]
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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'
+1 -1
View File
@@ -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],
+1 -1
View File
@@ -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]
+1 -1
View File
@@ -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',
+1 -1
View File
@@ -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]
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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'
+1 -1
View File
@@ -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,
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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,
+1 -1
View File
@@ -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'
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
@@ -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'
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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))}\/?$/
@@ -57,15 +57,15 @@ RSpec.describe OpenProject::TextFormatting,
Inline reference to variable setting: #{OpenProject::StaticRouting::UrlHelpers.host}
</p>
<p class="op-uc-p">
Inline reference to base_url variable: #{OpenProject::Application.root_url}
Inline reference to base_url variable: #{Rails.application.root_url}
</p>
<p class="op-uc-p">
<a href="#{OpenProject::Application.root_url}/foo/bar" rel="noopener noreferrer"
<a href="#{Rails.application.root_url}/foo/bar" rel="noopener noreferrer"
target="_top"
class="op-uc-link">Link with setting</a>
</p>
<p class="op-uc-p">
<a href="#{OpenProject::Application.root_url}/foo/bar" rel="noopener noreferrer"
<a href="#{Rails.application.root_url}/foo/bar" rel="noopener noreferrer"
target="_top"
class="op-uc-link">Saved and transformed link with setting</a>
</p>
@@ -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(
"<html><body>You are being <a href=\"#{storage.host}/index.php/apps/oauth2/authorize?client_id=" \
"#{oauth_client.client_id}&amp;redirect_uri=#{CGI.escape(OpenProject::Application.root_url)}%2Foauth_clients%2F#{oauth_client.client_id}%2F" \
"#{oauth_client.client_id}&amp;redirect_uri=#{CGI.escape(Rails.application.root_url)}" \
"%2Foauth_clients%2F#{oauth_client.client_id}%2F" \
"callback&amp;response_type=code&amp;state=#{nonce}\">redirected</a>." \
"</body></html>"
)
@@ -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(
"<html><body>You are being <a href=\"#{storage.host}/index.php/apps/oauth2/authorize?client_id=" \
"#{oauth_client.client_id}&amp;redirect_uri=#{CGI.escape(OpenProject::Application.root_url)}%2Foauth_clients%2F#{oauth_client.client_id}%2F" \
"#{oauth_client.client_id}&amp;redirect_uri=#{CGI.escape(Rails.application.root_url)}" \
"%2Foauth_clients%2F#{oauth_client.client_id}%2F" \
"callback&amp;response_type=code&amp;state=#{nonce}\">redirected</a>." \
"</body></html>"
)
@@ -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(
"<html><body>You are being <a href=\"#{storage.host}/index.php/apps/oauth2/authorize?client_id=" \
"#{oauth_client.client_id}&amp;redirect_uri=#{CGI.escape(OpenProject::Application.root_url)}%2Foauth_clients%2F#{oauth_client.client_id}%2F" \
"#{oauth_client.client_id}&amp;redirect_uri=#{CGI.escape(Rails.application.root_url)}" \
"%2Foauth_clients%2F#{oauth_client.client_id}%2F" \
"callback&amp;response_type=code&amp;state=#{nonce}\">redirected</a>." \
"</body></html>"
)