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

remove unneeded namespaces and add to registry at the right point

Ivan Kuchin965b69fc0278
diff --git a/lib_static/open_project/acts/favorable.rb b/lib_static/open_project/acts/favorable.rb
index 3a049474338..5a4073c2d27 100644
--- a/lib_static/open_project/acts/favorable.rb
+++ b/lib_static/open_project/acts/favorable.rb
@@ -46,11 +46,11 @@ module OpenProject
# acts_as_favorable expects that the including module defines a +visible?(user)+ method,
# as it's used to identify whether a user can actually favorite the object.
def acts_as_favorable
- return if included_modules.include?(::OpenProject::Acts::Favorable::InstanceMethods)
-
- OpenProject::Acts::Favorable::Registry.add(self)
+ return if included_modules.include?(InstanceMethods)
class_eval do
+ prepend InstanceMethods
+
has_many :favorites, as: :favored, dependent: :delete_all, validate: false
has_many :favoring_users, through: :favorites, source: :user, validate: false
@@ -60,7 +60,7 @@ module OpenProject
}
end
- send :prepend, ::OpenProject::Acts::Favorable::InstanceMethods
+ Registry.add(self)
end
end
diff --git a/lib_static/open_project/acts/watchable.rb b/lib_static/open_project/acts/watchable.rb
index 99de12d98aa..d39cfd36a8c 100644
--- a/lib_static/open_project/acts/watchable.rb
+++ b/lib_static/open_project/acts/watchable.rb
@@ -54,11 +54,13 @@ module OpenProject
# is allowed to watch
def acts_as_watchable(options = {})
- return if included_modules.include?(::OpenProject::Acts::Watchable::InstanceMethods)
+ return if included_modules.include?(InstanceMethods)
acts_as_watchable_enforce_project_association
class_eval do
+ prepend InstanceMethods
+
has_many :watchers, as: :watchable, dependent: :delete_all, validate: false
has_many :watcher_users, through: :watchers, source: :user, validate: false
@@ -70,10 +72,9 @@ module OpenProject
class_attribute :acts_as_watchable_options
self.acts_as_watchable_options = options
- ::OpenProject::Acts::Watchable::Registry.add(self)
end
- send :prepend, ::OpenProject::Acts::Watchable::InstanceMethods
+ Registry.add(self)
end
def acts_as_watchable_enforce_project_association