FEATURE: allows to enable/disable threading in UI (#22307)

Enabling/Disabling threading has been possible through command line until now. This commit introduces two new UIs:

- When creating a channel, it will be available once the category has been selected
- On the settings page of a channel for admins
This commit is contained in:
Joffrey JAFFEUX
2023-06-29 07:19:12 +02:00
committed by GitHub
parent de2febcc0c
commit ea0b8ca38c
16 changed files with 383 additions and 156 deletions

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
CHANNEL_EDITABLE_PARAMS = %i[name description slug]
CATEGORY_CHANNEL_EDITABLE_PARAMS = %i[auto_join_users allow_channel_wide_mentions]
CATEGORY_CHANNEL_EDITABLE_PARAMS = %i[auto_join_users allow_channel_wide_mentions threading_enabled]
class Chat::Api::ChannelsController < Chat::ApiController
def index
@ -36,7 +36,14 @@ class Chat::Api::ChannelsController < Chat::ApiController
def create
channel_params =
params.require(:channel).permit(:chatable_id, :name, :slug, :description, :auto_join_users)
params.require(:channel).permit(
:chatable_id,
:name,
:slug,
:description,
:auto_join_users,
:threading_enabled,
)
# NOTE: We don't allow creating channels for anything but category chatable types
# at the moment. This may change in future, at which point we will need to pass in