mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 02:04:53 +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:
@ -49,26 +49,12 @@ describe ImportScripts::Base do
|
||||
|
||||
it "creates bookmarks, posts, and users" do
|
||||
MockSpecImporter.new(import_data).perform
|
||||
expect(Bookmark.count).to eq(5)
|
||||
expect(Bookmark.where(bookmarkable_type: "Post").count).to eq(5)
|
||||
expect(Post.count).to eq(5)
|
||||
expect(User.where('id > 0').count).to eq(1)
|
||||
expect(SiteSetting.purge_unactivated_users_grace_period_days).to eq(60)
|
||||
end
|
||||
|
||||
context "when polymorphic bookmarks are enabled" do
|
||||
before do
|
||||
SiteSetting.use_polymorphic_bookmarks = true
|
||||
end
|
||||
|
||||
it "creates bookmarks, posts, and users" do
|
||||
MockSpecImporter.new(import_data).perform
|
||||
expect(Bookmark.where(bookmarkable_type: "Post").count).to eq(5)
|
||||
expect(Post.count).to eq(5)
|
||||
expect(User.where('id > 0').count).to eq(1)
|
||||
expect(SiteSetting.purge_unactivated_users_grace_period_days).to eq(60)
|
||||
end
|
||||
end
|
||||
|
||||
it "does not change purge unactivated users setting if disabled" do
|
||||
SiteSetting.purge_unactivated_users_grace_period_days = 0
|
||||
MockSpecImporter.new(import_data).perform
|
||||
|
Reference in New Issue
Block a user