mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 19:39:30 +08:00
FIX: deleted misconfigured embeddable hosts (#19833)
When EmbeddableHost is configured for a specific category and that category is deleted, then EmbeddableHost should be deleted as well. In addition, migration was added to fix existing data.
This commit is contained in:

committed by
GitHub

parent
f122f24b35
commit
f409e977a9
@ -577,6 +577,12 @@ RSpec.describe Category do
|
||||
expect(SiteSetting.shared_drafts_category).to be_blank
|
||||
end
|
||||
|
||||
it "deletes related embeddable host" do
|
||||
embeddable_host = Fabricate(:embeddable_host, category: @category)
|
||||
@category.destroy!
|
||||
expect { embeddable_host.reload }.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
|
||||
it "triggers a extensibility event" do
|
||||
event = DiscourseEvent.track(:category_destroyed) { @category.destroy }
|
||||
|
||||
|
Reference in New Issue
Block a user