mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Change Bookmarkable registration to DiscoursePluginRegistry (#20556)
Similar spirit to e195e6f614
,
this moves the Bookmarkable registration to DiscoursePluginRegistry
so plugins which are not enabled do not register additional
bookmarkable classes.
This commit is contained in:
@@ -280,7 +280,6 @@ after_initialize do
|
||||
Category.prepend Chat::CategoryExtension
|
||||
User.prepend Chat::UserExtension
|
||||
Jobs::UserEmail.prepend Chat::UserEmailExtension
|
||||
Bookmark.register_bookmarkable(ChatMessageBookmarkable)
|
||||
end
|
||||
|
||||
if Oneboxer.respond_to?(:register_local_handler)
|
||||
@@ -777,6 +776,8 @@ after_initialize do
|
||||
register_user_destroyer_on_content_deletion_callback(
|
||||
Proc.new { |user| Jobs.enqueue(:delete_user_messages, user_id: user.id) },
|
||||
)
|
||||
|
||||
register_bookmarkable(ChatMessageBookmarkable)
|
||||
end
|
||||
|
||||
if Rails.env == "test"
|
||||
|
@@ -11,10 +11,12 @@ describe ChatMessageBookmarkable do
|
||||
fab!(:channel) { Fabricate(:category_channel) }
|
||||
|
||||
before do
|
||||
Bookmark.register_bookmarkable(ChatMessageBookmarkable)
|
||||
register_test_bookmarkable(ChatMessageBookmarkable)
|
||||
UserChatChannelMembership.create(chat_channel: channel, user: user, following: true)
|
||||
end
|
||||
|
||||
after { DiscoursePluginRegistry.reset! }
|
||||
|
||||
let!(:message1) { Fabricate(:chat_message, chat_channel: channel) }
|
||||
let!(:message2) { Fabricate(:chat_message, chat_channel: channel) }
|
||||
let!(:bookmark1) do
|
||||
|
@@ -499,8 +499,6 @@ describe ChatMessage do
|
||||
end
|
||||
|
||||
describe "bookmarks" do
|
||||
before { Bookmark.register_bookmarkable(ChatMessageBookmarkable) }
|
||||
|
||||
it "destroys bookmarks" do
|
||||
message_1 = Fabricate(:chat_message)
|
||||
bookmark_1 = Fabricate(:bookmark, bookmarkable: message_1)
|
||||
|
@@ -18,9 +18,6 @@ module ChatSystemHelpers
|
||||
end
|
||||
|
||||
Group.refresh_automatic_groups!
|
||||
|
||||
# this is reset after each test
|
||||
Bookmark.register_bookmarkable(ChatMessageBookmarkable)
|
||||
end
|
||||
|
||||
def chat_thread_chain_bootstrap(channel:, users:, messages_count: 4)
|
||||
|
Reference in New Issue
Block a user