From 6eac5926eb710043db97710331b791da75c79b9f Mon Sep 17 00:00:00 2001 From: ulferts Date: Sat, 1 Mar 2025 21:02:09 +0100 Subject: [PATCH] adapt deprecation warning --- app/helpers/application_helper.rb | 2 +- app/models/setting.rb | 2 +- lib/open_project/omni_auth/authorization.rb | 2 +- lib/redmine/plugin.rb | 2 +- lib_static/open_project/configuration.rb | 3 ++- lib_static/open_project/database.rb | 2 +- modules/reporting/app/models/entry.rb | 4 ++-- modules/storages/app/models/storages/storage.rb | 2 +- 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index cf7d5b1e665..989a210678f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -388,7 +388,7 @@ module ApplicationHelper end def calendar_for(*_args) - ActiveSupport::Deprecation.warn( + ActiveSupport::Deprecation.new.warn( "calendar_for has been removed. Please use the opce-basic-single-date-picker angular component instead", caller ) diff --git a/app/models/setting.rb b/app/models/setting.rb index 4ee805e1410..eb2be5577fc 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -93,7 +93,7 @@ class Setting < ApplicationRecord definition = Settings::Definition[:#{name}] if definition.format != :boolean - ActiveSupport::Deprecation.warn "Calling #{self}.#{name}? is deprecated since it is not a boolean", caller + ActiveSupport::Deprecation.new.warn "Calling #{self}.#{name}? is deprecated since it is not a boolean", caller end value = self[:#{name}] diff --git a/lib/open_project/omni_auth/authorization.rb b/lib/open_project/omni_auth/authorization.rb index b396478f54b..7848ead8c01 100644 --- a/lib/open_project/omni_auth/authorization.rb +++ b/lib/open_project/omni_auth/authorization.rb @@ -107,7 +107,7 @@ module OpenProject # including user info and credentials. # @yieldparam context The context from which the callback is called, e.g. a Controller. def self.after_login(&) - ActiveSupport::Deprecation.warn( + ActiveSupport::Deprecation.new.warn( "after_login does not return the actually logged in user and has been deprecated. " \ "Please use OpenProject::Hook omniauth_user_authorized or user_logged_in hooks instead", caller diff --git a/lib/redmine/plugin.rb b/lib/redmine/plugin.rb index d1a9afc2313..300e2fbc42f 100644 --- a/lib/redmine/plugin.rb +++ b/lib/redmine/plugin.rb @@ -376,7 +376,7 @@ module Redmine # :nodoc: # # Note that :view_scrums permission is required to view these events in the activity view. def activity_provider(*) - ActiveSupport::Deprecation.warn("Use ActsAsOpEngine#activity_provider instead.") + ActiveSupport::Deprecation.new.warn("Use ActsAsOpEngine#activity_provider instead.") OpenProject::Activity.register(*) end diff --git a/lib_static/open_project/configuration.rb b/lib_static/open_project/configuration.rb index 92bc6b2876a..fe17865ed3d 100644 --- a/lib_static/open_project/configuration.rb +++ b/lib_static/open_project/configuration.rb @@ -133,7 +133,8 @@ module OpenProject define_singleton_method :"#{definition.name}?" do if definition.format != :boolean - ActiveSupport::Deprecation.warn "Calling #{self}.#{definition.name}? is deprecated since it is not a boolean", caller + ActiveSupport::Deprecation.new.warn "Calling #{self}.#{definition.name}? is deprecated since it is not a boolean", + caller end TRUE_VALUES.include? self[definition.name] end diff --git a/lib_static/open_project/database.rb b/lib_static/open_project/database.rb index 2e127e94a9e..83c83ae8cae 100644 --- a/lib_static/open_project/database.rb +++ b/lib_static/open_project/database.rb @@ -160,7 +160,7 @@ module OpenProject def self.mysql?(_arg = nil) message = ".mysql? is no longer supported and will always return false. Remove the call." - ActiveSupport::Deprecation.warn message, caller + ActiveSupport::Deprecation.new.warn message, caller false end diff --git a/modules/reporting/app/models/entry.rb b/modules/reporting/app/models/entry.rb index 1643adaa266..988554fc887 100644 --- a/modules/reporting/app/models/entry.rb +++ b/modules/reporting/app/models/entry.rb @@ -64,12 +64,12 @@ module Entry private def all(*args) - ActiveSupport::Deprecation.warn("Passing arguments is deprecated") if args.any? + ActiveSupport::Deprecation.new.warn("Passing arguments is deprecated") if args.any? find_many :all # *args end def count(*args) - ActiveSupport::Deprecation.warn("Passing arguments is deprecated") if args.any? + ActiveSupport::Deprecation.new.warn("Passing arguments is deprecated") if args.any? find_many :count # *args end diff --git a/modules/storages/app/models/storages/storage.rb b/modules/storages/app/models/storages/storage.rb index 984282782d4..b3087984e7d 100644 --- a/modules/storages/app/models/storages/storage.rb +++ b/modules/storages/app/models/storages/storage.rb @@ -120,7 +120,7 @@ module Storages end def automatically_managed? - ActiveSupport::Deprecation.warn( + ActiveSupport::Deprecation.new.warn( "`#automatically_managed?` is deprecated. Use `#automatic_management_enabled?` instead. " \ "NOTE: The new method name better reflects the actual behavior of the storage. " \ "It's not the storage that is automatically managed, rather the Project (Storage) Folder is. " \