mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 09:57:25 +08:00
FIX: generates automatic slug for trashed channels (#19908)
Prior to this fix trashed channels would still prevent a channel with the same slug to be created. This commit generates a new slug on trash and frees the slug for future usage. The format used for the slug is: `YYYYMMDD-HHMM-OLD_SLUG-deleted` truncated to the max length of a channel name.
This commit is contained in:
@ -38,6 +38,13 @@ class Chat::Api::ChatChannelsController < Chat::Api
|
||||
|
||||
begin
|
||||
ChatChannel.transaction do
|
||||
channel_from_params.update!(
|
||||
slug:
|
||||
"#{Time.now.strftime("%Y%m%d-%H%M")}-#{channel_from_params.slug}-deleted".truncate(
|
||||
SiteSetting.max_topic_title_length,
|
||||
omission: "",
|
||||
),
|
||||
)
|
||||
channel_from_params.trash!(current_user)
|
||||
StaffActionLogger.new(current_user).log_custom(
|
||||
"chat_channel_delete",
|
||||
|
Reference in New Issue
Block a user