FIX: Allow deletion of categories when chat channel is not present

Currently it’s not possible to delete a category if an associated chat
channel is present even if there are no messages in this channel.
This can lead to annoying situations for our users.

This patch addresses the issue by checking if the channel is empty
instead of just checking if there is a channel.
This commit is contained in:
Loïc Guitaut
2022-11-03 17:21:17 +01:00
committed by Loïc Guitaut
parent b9d4336a20
commit 9c482a645c
7 changed files with 159 additions and 10 deletions

View File

@ -177,6 +177,6 @@ module Chat::GuardianExtensions
end
def can_delete_category?(category)
super && !category.category_channel
super && category.deletable_for_chat?
end
end