Adds a feature flag to control availability of DMs in shared channels (#28920)

* Adds a feature flag to control availability of DMs in shared channels

* Reverse feature flag wording
Этот коммит содержится в:
Miguel de la Cruz
2024-10-24 19:38:00 +02:00
коммит произвёл GitHub
родитель 6075b1cd4e
Коммит cb03009992
6 изменённых файлов: 18 добавлений и 11 удалений

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

@@ -11,7 +11,7 @@ import type {ServerError} from '@mattermost/types/errors';
import {savePreferences} from 'mattermost-redux/actions/preferences';
import {Permissions} from 'mattermost-redux/constants';
import {getChannel, makeGetChannel, getDirectChannel} from 'mattermost-redux/selectors/entities/channels';
import {getConfig} from 'mattermost-redux/selectors/entities/general';
import {getConfig, getFeatureFlagValue} from 'mattermost-redux/selectors/entities/general';
import {get, getBool, getInt} from 'mattermost-redux/selectors/entities/preferences';
import {haveIChannelPermission} from 'mattermost-redux/selectors/entities/roles';
import {getCurrentUserId, isCurrentUserGuestUser, getStatusForUserId, makeGetDisplayName} from 'mattermost-redux/selectors/entities/users';
@@ -168,8 +168,9 @@ const AdvancedTextEditor = ({
const readOnlyChannel = !canPost;
const hasDraftMessage = Boolean(draft.message);
const enableSharedChannelsDMs = useSelector((state: GlobalState) => getFeatureFlagValue(state, 'EnableSharedChannelsDMs') === 'true');
const isDMOrGMRemote = isChannelShared && (channelType === Constants.DM_CHANNEL || channelType === Constants.GM_CHANNEL);
const isDisabled = Boolean(readOnlyChannel || isDMOrGMRemote);
const isDisabled = Boolean(readOnlyChannel || (!enableSharedChannelsDMs && isDMOrGMRemote));
const handleShowPreview = useCallback(() => {
setShowPreview((prev) => !prev);
@@ -484,11 +485,11 @@ const AdvancedTextEditor = ({
defaultMessage: 'This channel is read-only. Only members with permission can post here.',
},
);
} else if (isDMOrGMRemote) {
} else if (!enableSharedChannelsDMs && isDMOrGMRemote) {
createMessage = formatMessage(
{
id: 'create_post.dm_or_gm_remote',
defaultMessage: 'Direct Messagess and Group Messages with remote users are not supported.',
defaultMessage: 'Direct Messages and Group Messages with remote users are not supported.',
},
);
} else {

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

@@ -3437,7 +3437,7 @@
"create_group_memberships_modal.create": "Yes",
"create_group_memberships_modal.desc": "You're about to add or re-add {username} to teams and channels based on their LDAP group membership. You can revert this change at any time.",
"create_group_memberships_modal.title": "Re-add {username} to teams and channels",
"create_post.dm_or_gm_remote": "Direct Messagess and Group Messages with remote users are not supported.",
"create_post.dm_or_gm_remote": "Direct Messages and Group Messages with remote users are not supported.",
"create_post.error_message": "Your message is too long. Character count: {length}/{limit}",
"create_post.file_limit_sticky_banner.admin_message": "New uploads will automatically archive older files. To view them again, you can delete older files or <a>upgrade to a paid plan.</a>",
"create_post.file_limit_sticky_banner.messageTitle": "Your free plan is limited to {storageGB} of files.",