diff --git a/plugins/chat/app/controllers/chat/api/channels_controller.rb b/plugins/chat/app/controllers/chat/api/channels_controller.rb index 6e6ca0ef379..56dc148ec8d 100644 --- a/plugins/chat/app/controllers/chat/api/channels_controller.rb +++ b/plugins/chat/app/controllers/chat/api/channels_controller.rb @@ -1,12 +1,8 @@ # frozen_string_literal: true class Chat::Api::ChannelsController < Chat::ApiController - CHANNEL_EDITABLE_PARAMS ||= %i[name description slug] - CATEGORY_CHANNEL_EDITABLE_PARAMS ||= %i[ - auto_join_users - allow_channel_wide_mentions - threading_enabled - ] + CHANNEL_EDITABLE_PARAMS ||= %i[name description slug threading_enabled] + CATEGORY_CHANNEL_EDITABLE_PARAMS ||= %i[auto_join_users allow_channel_wide_mentions] def index permitted = params.permit(:filter, :limit, :offset, :status) diff --git a/plugins/chat/app/models/chat/direct_message_channel.rb b/plugins/chat/app/models/chat/direct_message_channel.rb index 2e5a1b8e2a9..23eea91aa8b 100644 --- a/plugins/chat/app/models/chat/direct_message_channel.rb +++ b/plugins/chat/app/models/chat/direct_message_channel.rb @@ -3,6 +3,7 @@ module Chat class DirectMessageChannel < Channel alias_method :direct_message, :chatable + before_validation(on: :create) { self.threading_enabled = true } def direct_message_channel? true diff --git a/plugins/chat/assets/javascripts/discourse/components/chat/routes/channel-info-settings.gjs b/plugins/chat/assets/javascripts/discourse/components/chat/routes/channel-info-settings.gjs index 292cfaf8098..75fea4dfed5 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat/routes/channel-info-settings.gjs +++ b/plugins/chat/assets/javascripts/discourse/components/chat/routes/channel-info-settings.gjs @@ -98,10 +98,14 @@ export default class ChatRouteChannelInfoSettings extends Component { return this.args.channel.isCategoryChannel && this.args.channel.isOpen; } - get toggleThreadingAvailable() { + get toggleThreadingCategoryChannel() { return this.args.channel.isCategoryChannel && this.args.channel.isOpen; } + get toggleThreadingDirectMessage() { + return this.args.channel.isDirectMessageChannel && this.args.channel.isOpen; + } + get channelWideMentionsDescription() { return I18n.t("chat.settings.channel_wide_mentions_description", { channel: this.args.channel.title, @@ -420,6 +424,28 @@ export default class ChatRouteChannelInfoSettings extends Component { {{/if}} + + {{#if this.toggleThreadingDirectMessage}} + + <:action> + + + + <:description> + {{this.toggleThreadingDescription}} + + + {{/if}} {{/if}} @@ -482,7 +508,7 @@ export default class ChatRouteChannelInfoSettings extends Component { {{/if}} - {{#if this.toggleThreadingAvailable}} + {{#if this.toggleThreadingCategoryChannel}} <:action>