Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

deprecate attach_files

ulferts2bc34e5006bc
diff --git a/app/services/work_packages/update_service.rb b/app/services/work_packages/update_service.rb
index b5b54d58f1f..16ed7b9d4cb 100644
--- a/app/services/work_packages/update_service.rb
+++ b/app/services/work_packages/update_service.rb
@@ -28,6 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
+# TODO: use default update base class
class WorkPackages::UpdateService
include ::WorkPackages::Shared::UpdateAncestors
include ::Shared::ServiceContext
diff --git a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb
index 15c404edc19..22c5164be07 100644
--- a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb
+++ b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb
@@ -29,8 +29,10 @@
module Redmine
module Acts
module Attachable
- def self.included(base)
- base.extend ClassMethods
+ extend ActiveSupport::Concern
+
+ included do
+ extend ClassMethods
end
def self.attachables
@@ -51,6 +53,8 @@ module Redmine
attr_accessor :attachments_replacements,
:attachments_claimed
send :include, Redmine::Acts::Attachable::InstanceMethods
+
+ OpenProject::Deprecation.deprecate_method self, :attach_files
end
private
@@ -157,9 +161,10 @@ module Redmine
(persisted? && allowed_to_on_attachment?(user, self.class.attachable_options[:add_on_persisted_permission]))
end
- # TODO: Check if we can remove this.
- # If the attachments where only added via the Attachments::CreateService, it would be thread safe.
# Bulk attaches a set of files to an object
+ # @deprecated
+ # Either use the already existing Attachments::CreateService or
+ # write/extend Services for the attached to object.
def attach_files(attachments)
return unless attachments&.is_a?(Hash)
diff --git a/modules/meeting/app/controllers/meeting_contents_controller.rb b/modules/meeting/app/controllers/meeting_contents_controller.rb
index 48995e80262..257ae60d88a 100644
--- a/modules/meeting/app/controllers/meeting_contents_controller.rb
+++ b/modules/meeting/app/controllers/meeting_contents_controller.rb
@@ -67,7 +67,6 @@ class MeetingContentsController < ApplicationController
if @content.save
flash[:notice] = l(:notice_successful_update)
redirect_back_or_default controller: '/meetings', action: 'show', id: @meeting
- else
end
rescue ActiveRecord::StaleObjectError
# Optimistic locking exception