mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
FIX: correctly deletes webhook_events with webhook (#23097)
Each time a message is created through a webhook, we create we webhook_event associated to this webhook. When destroying a webhook, we were not destroying the webhook_events which was causing orphans records and more importantly errors in the app expecting to find and associated webhook.
This commit is contained in:
10
plugins/chat/spec/models/chat/incoming_webhook_spec.rb
Normal file
10
plugins/chat/spec/models/chat/incoming_webhook_spec.rb
Normal file
@ -0,0 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Chat::IncomingWebhook do
|
||||
it do
|
||||
is_expected.to have_many(:chat_webhook_events)
|
||||
.with_foreign_key("incoming_chat_webhook_id")
|
||||
.class_name("Chat::WebhookEvent")
|
||||
.dependent(:delete_all)
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user