mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:51:18 +08:00
FIX: Delete associated channel upon category deletion
Currently when a category is deleted, if it has an associated chat channel, the latter won’t be deleted automatically. The fix is quite simple as we were simply missing a `dependent: :destroy` option on the existing relation.
This commit is contained in:

committed by
Loïc Guitaut

parent
e9863b145c
commit
01392ab90c
@ -5,7 +5,7 @@ module Chat::CategoryExtension
|
||||
|
||||
include Chatable
|
||||
|
||||
prepended { has_one :category_channel, as: :chatable }
|
||||
prepended { has_one :category_channel, as: :chatable, dependent: :destroy }
|
||||
|
||||
def cannot_delete_reason
|
||||
return I18n.t("category.cannot_delete.has_chat_channels") if category_channel
|
||||
|
Reference in New Issue
Block a user