mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
FEATURE: Promote polymorphic bookmarks to default and migrate (#16729)
This commit migrates all bookmarks to be polymorphic (using the bookmarkable_id and bookmarkable_type) columns. It also deletes all the old code guarded behind the use_polymorphic_bookmarks setting and changes that setting to true for all sites and by default for the sake of plugins. No data is deleted in the migrations, the old post_id and for_topic columns for bookmarks will be dropped later on.
This commit is contained in:
@ -807,13 +807,13 @@ describe PostCreator do
|
||||
|
||||
context "when the user has bookmarks with auto_delete_preference on_owner_reply" do
|
||||
before do
|
||||
Fabricate(:bookmark, user: user, post: Fabricate(:post, topic: topic), auto_delete_preference: Bookmark.auto_delete_preferences[:on_owner_reply])
|
||||
Fabricate(:bookmark, user: user, post: Fabricate(:post, topic: topic), auto_delete_preference: Bookmark.auto_delete_preferences[:on_owner_reply])
|
||||
Fabricate(:bookmark, user: user, bookmarkable: Fabricate(:post, topic: topic), auto_delete_preference: Bookmark.auto_delete_preferences[:on_owner_reply])
|
||||
Fabricate(:bookmark, user: user, bookmarkable: Fabricate(:post, topic: topic), auto_delete_preference: Bookmark.auto_delete_preferences[:on_owner_reply])
|
||||
TopicUser.create!(topic: topic, user: user, bookmarked: true)
|
||||
end
|
||||
|
||||
it "deletes the bookmarks, but not the ones without an auto_delete_preference" do
|
||||
Fabricate(:bookmark, post: Fabricate(:post, topic: topic), user: user)
|
||||
Fabricate(:bookmark, bookmarkable: Fabricate(:post, topic: topic), user: user)
|
||||
Fabricate(:bookmark, user: user)
|
||||
creator.create
|
||||
expect(Bookmark.where(user: user).count).to eq(2)
|
||||
|
Reference in New Issue
Block a user