mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 20:44:40 +08:00
DEV: Change Bookmarkable registration to DiscoursePluginRegistry (#20556)
Similar spirit to e195e6f614de7a4c4f151ad947578fb69f8917f0, this moves the Bookmarkable registration to DiscoursePluginRegistry so plugins which are not enabled do not register additional bookmarkable classes.
This commit is contained in:
@ -1221,6 +1221,16 @@ class Plugin::Instance
|
||||
DiscoursePluginRegistry.register_user_destroyer_on_content_deletion_callback(callback, self)
|
||||
end
|
||||
|
||||
##
|
||||
# Register a class that implements [BaseBookmarkable], which represents another
|
||||
# [ActiveRecord::Model] that may be bookmarked via the [Bookmark] model's
|
||||
# polymorphic association. The class handles create and destroy hooks, querying,
|
||||
# and reminders among other things.
|
||||
def register_bookmarkable(klass)
|
||||
return if Bookmark.registered_bookmarkable_from_type(klass.model.name).present?
|
||||
DiscoursePluginRegistry.register_bookmarkable(RegisteredBookmarkable.new(klass), self)
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def self.js_path
|
||||
|
Reference in New Issue
Block a user