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

there should be no two separate ClassMethods modules defined in same file

Ivan Kuchin8d1f23ddc60a
diff --git a/lib_static/open_project/acts/watchable.rb b/lib_static/open_project/acts/watchable.rb
index 7a0bc56e232..657d92204d6 100644
--- a/lib_static/open_project/acts/watchable.rb
+++ b/lib_static/open_project/acts/watchable.rb
@@ -91,6 +91,10 @@ module OpenProject
end
module InstanceMethods
+ def self.prepended(base)
+ base.extend AddClassMethods
+ end
+
def possible_watcher?(user)
user.allowed_based_on_permission_context?(self.class.acts_as_watchable_permission,
project:,
@@ -156,7 +160,7 @@ module OpenProject
watcher_user_ids.any? { |uid| uid == user.id })
end
- module ClassMethods
+ module AddClassMethods
def acts_as_watchable_permission
acts_as_watchable_options[:permission] || :"view_#{name.underscore.pluralize}"
end
diff --git a/lib_static/plugins/acts_as_customizable/lib/acts_as_customizable.rb b/lib_static/plugins/acts_as_customizable/lib/acts_as_customizable.rb
index 88e9ec7eb1f..103a3db31a6 100644
--- a/lib_static/plugins/acts_as_customizable/lib/acts_as_customizable.rb
+++ b/lib_static/plugins/acts_as_customizable/lib/acts_as_customizable.rb
@@ -60,6 +60,7 @@ module Redmine
module InstanceMethods
def self.included(base)
+ base.extend AddClassMethods
base.extend HumanAttributeName
end
@@ -437,7 +438,7 @@ module Redmine
@custom_field_values_cache ||= {}
end
- module ClassMethods
+ module AddClassMethods
def available_custom_fields(_model)
RequestStore.fetch(:"#{name.underscore}_custom_fields") do
CustomField.where(type: "#{name}CustomField").order(:position)
diff --git a/lib_static/plugins/acts_as_event/lib/acts_as_event.rb b/lib_static/plugins/acts_as_event/lib/acts_as_event.rb
index 3110a7003cb..cb594318001 100644
--- a/lib_static/plugins/acts_as_event/lib/acts_as_event.rb
+++ b/lib_static/plugins/acts_as_event/lib/acts_as_event.rb
@@ -92,9 +92,6 @@ module Redmine
option
end
end
-
- module ClassMethods
- end
end
end
end
diff --git a/lib_static/plugins/acts_as_searchable/lib/acts_as_searchable.rb b/lib_static/plugins/acts_as_searchable/lib/acts_as_searchable.rb
index fdedbe088c0..24f4bc4fb3e 100644
--- a/lib_static/plugins/acts_as_searchable/lib/acts_as_searchable.rb
+++ b/lib_static/plugins/acts_as_searchable/lib/acts_as_searchable.rb
@@ -73,7 +73,11 @@ module Redmine
end
module InstanceMethods
- module ClassMethods
+ def self.included(base)
+ base.extend AddClassMethods
+ end
+
+ module AddClassMethods
# Searches the model for the given tokens
# projects argument can be either nil (will search all projects), a project or an array of projects
# Returns the results and the results count