Automatic channel category sorting (#30866)

* Automatic channel category sorting

* Fix types

* AIed

* Fix issue where categories are updated for all users

* Move all logic to server, clean up

* PR feedback

* Fix lint

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Devin Binnie
2025-06-11 14:29:36 -04:00
коммит произвёл GitHub
родитель c6a11763a8
Коммит 25a4839a9e
17 изменённых файлов: 289 добавлений и 30 удалений

Просмотреть файл

@@ -6812,6 +6812,13 @@ const AdminDefinition: AdminDefinitionType = {
help_text: defineMessage({id: 'admin.experimental.youtubeReferrerPolicy.desc', defaultMessage: 'When true, the referrer policy for embedded YouTube videos will be set to "strict-origin-when-cross-origin" which resolves issues where YouTube video previews display as unavailable, while balancing the need to protect user privacy with some degree of referral data to support web functionalities, like analytics, logging, and third-party integrations. When false, the referrer policy will be set to "no-referrer" which enhances user privacy by not disclosing the source URL, but limits the ability to track user engagement and traffic sources in analytics tools.'}),
isDisabled: it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.EXPERIMENTAL.FEATURES)),
},
{
type: 'bool',
key: 'ExperimentalSettings.ExperimentalChannelCategorySorting',
label: defineMessage({id: 'admin.experimental.channelCategorySorting.title', defaultMessage: 'Channel Category Sorting:'}),
help_text: defineMessage({id: 'admin.experimental.channelCategorySorting.desc', defaultMessage: 'When true, channels will be automatically sorted into categories based on their names using a "/" delimiter.'}),
isDisabled: it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.EXPERIMENTAL.FEATURES)),
},
],
},
},

Просмотреть файл

@@ -237,7 +237,7 @@ function ChannelSettingsInfoTab({
header: channelHeader.trim(),
};
const {error} = await dispatch(patchChannel(channel.id, updated));
const {data, error} = await dispatch(patchChannel(channel.id, updated));
if (error) {
handleServerError(error as ServerError);
return false;
@@ -245,10 +245,10 @@ function ChannelSettingsInfoTab({
// After every successful save, update local state to match the saved values
// with this, we make sure that the unsavedChanges check will return false after saving
setDisplayName(updated.display_name);
setChannelURL(updated.name);
setChannelPurpose(updated.purpose);
setChannelHeader(updated.header);
setDisplayName(data?.display_name ?? updated.display_name);
setChannelURL(data?.name ?? updated.name);
setChannelPurpose(data?.purpose ?? updated.purpose);
setChannelHeader(data?.header ?? updated.header);
return true;
}, [channel, displayName, channelUrl, channelPurpose, channelHeader, channelType, setFormError, handleServerError]);

Просмотреть файл

@@ -1033,6 +1033,8 @@
"admin.experimental.allowCustomThemes.title": "Allow Custom Themes:",
"admin.experimental.allowedEmailDomain.desc": "(Optional) When set, users must have an email ending in this domain to move threads. Multiple domains can be specified by separating them with commas.",
"admin.experimental.allowedEmailDomain.title": "Allowed Email Domain",
"admin.experimental.channelCategorySorting.desc": "When true, channels will be automatically sorted into categories based on their names using a \"/\" delimiter.",
"admin.experimental.channelCategorySorting.title": "Channel Category Sorting:",
"admin.experimental.clientSideCertCheck.desc": "When **primary**, after the client side certificate is verified, users email is retrieved from the certificate and is used to log in without a password. When **secondary**, after the client side certificate is verified, users email is retrieved from the certificate and matched against the one supplied by the user. If they match, the user logs in with regular email/password credentials.",
"admin.experimental.clientSideCertCheck.options.primary": "primary",
"admin.experimental.clientSideCertCheck.options.secondary": "secondary",

Просмотреть файл

@@ -69,6 +69,7 @@ export type Channel = {
policy_id?: string | null;
banner_info?: ChannelBanner;
policy_enforced?: boolean;
default_category_name?: string;
};
export type ServerChannel = Channel & {

Просмотреть файл

@@ -112,6 +112,7 @@ export type ClientConfig = {
EnableUserDeactivation: string;
EnableUserTypingMessages: string;
EnforceMultifactorAuthentication: string;
ExperimentalChannelCategorySorting: string;
ExperimentalClientSideCertCheck: string;
ExperimentalClientSideCertEnable: string;
ExperimentalEnableAuthenticationTransfer: string;
@@ -822,6 +823,7 @@ export type ExperimentalSettings = {
DisableWakeUpReconnectHandler: boolean;
UsersStatusAndProfileFetchingPollIntervalMilliseconds: number;
YoutubeReferrerPolicy: boolean;
ExperimentalChannelCategorySorting: boolean;
};
export type AnalyticsSettings = {