[MM-60853] Replace FormattedMarkdownMessage in 'webapp/channels/src/components/admin_console/team_channel_settings/convert_and_remove_confirm_modal.tsx' with FormattedMessage (#28718)

Этот коммит содержится в:
Zubair Imtiaz
2024-10-23 10:13:37 +05:00
коммит произвёл GitHub
родитель 0c90b0363b
Коммит 90cc1f6931
3 изменённых файлов: 79 добавлений и 42 удалений

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

@@ -5,7 +5,6 @@ import React from 'react';
import {FormattedMessage, defineMessages} from 'react-intl'; import {FormattedMessage, defineMessages} from 'react-intl';
import ConfirmModal from 'components/confirm_modal'; import ConfirmModal from 'components/confirm_modal';
import FormattedMarkdownMessage from 'components/formatted_markdown_message';
type Props = { type Props = {
@@ -40,19 +39,29 @@ type Props = {
removeAmount: number; removeAmount: number;
}; };
const ConvertAndRemoveConfirmModal = ({show, onConfirm, onCancel, displayName, toPublic, removeAmount}: Props) => { const ConvertAndRemoveConfirmModal = ({
let titleMessage; show,
let convertMessage; onConfirm,
let confirmMessage; onCancel,
if (toPublic) { displayName,
titleMessage = messages.toPublicTitle; toPublic,
convertMessage = messages.toPublicMessage; removeAmount,
confirmMessage = messages.toPublicConfirm; }: Props) => {
} else { const titleMessage = toPublic ?
titleMessage = messages.toPrivateTitle; messages.toPublicTitle :
convertMessage = messages.toPrivateMessage; messages.toPrivateTitle;
confirmMessage = messages.toPrivateConfirm;
} const convertMessage = toPublic ?
messages.toPublicMessage :
messages.toPrivateMessage;
const convertMessageSecondLine = toPublic ?
messages.toPublicMessageSecondLine :
messages.toPrivateMessageSecondLine;
const confirmMessage = toPublic ?
messages.toPublicConfirm :
messages.toPrivateConfirm;
const title = ( const title = (
<FormattedMessage <FormattedMessage
@@ -62,21 +71,37 @@ const ConvertAndRemoveConfirmModal = ({show, onConfirm, onCancel, displayName, t
); );
const message = ( const message = (
<div> <>
<p> <p>
<FormattedMarkdownMessage <FormattedMessage
{...convertMessage} {...convertMessage}
values={{displayName}} values={{
displayName: <strong>{displayName}</strong>,
}}
/> />
</p> </p>
<p> <p>
<FormattedMessage <FormattedMessage
id='admin.team_channel_settings.removeConfirmModal.messageChannel' {...convertMessageSecondLine}
defaultMessage='{amount, number} {amount, plural, one {user} other {users}} will be removed. They are not in groups linked to this channel. Are you sure you wish to remove these users?' values={{
displayName: <strong>{displayName}</strong>,
}}
/>
</p>
<p>
<FormattedMessage
id='admin.team_channel_settings.removeConfirmModal.messageChannelFirstLine'
defaultMessage='{amount, number} {amount, plural, one {user} other {users}} will be removed. They are not in groups linked to this channel.'
values={{amount: removeAmount}} values={{amount: removeAmount}}
/> />
</p> </p>
</div> <p>
<FormattedMessage
id='admin.team_channel_settings.removeConfirmModal.messageChannelSecondLine'
defaultMessage='Are you sure you wish to remove these users?'
/>
</p>
</>
); );
const confirmButton = ( const confirmButton = (
@@ -113,33 +138,43 @@ const ConvertAndRemoveConfirmModal = ({show, onConfirm, onCancel, displayName, t
const messages = defineMessages({ const messages = defineMessages({
toPrivateConfirm: { toPrivateConfirm: {
id: 'admin.team_channel_settings.convertAndRemoveConfirmModal.toPrivateConfirm', id: 'admin.team_channel_settings.convertAndRemoveConfirmModal.toPrivateConfirm',
defaultMessage: 'Yes, convert channel to private and remove {amount, number} {amount, plural, one {user} other {users}}', defaultMessage:
'Yes, convert channel to private and remove {amount, number} {amount, plural, one {user} other {users}}',
}, },
toPrivateMessage: { toPrivateMessage: {
id: 'admin.team_channel_settings.convertConfirmModal.toPrivateMessage', id: 'admin.team_channel_settings.convertConfirmModal.toPrivateMessageFirstLine',
defaultMessage:
// This eslint-disable comment can be removed once this component no longer uses FormattedMarkdownMessage 'When you convert {displayName} to a private channel, history and membership are preserved. Publicly shared files remain accessible to anyone with the link. Membership in a private channel is by invitation only.',
// eslint-disable-next-line formatjs/no-multiple-whitespaces },
defaultMessage: 'When you convert **{displayName}** to a private channel, history and membership are preserved. Publicly shared files remain accessible to anyone with the link. Membership in a private channel is by invitation only. \n \nAre you sure you want to convert **{displayName}** to a private channel?', toPrivateMessageSecondLine: {
id: 'admin.team_channel_settings.convertConfirmModal.toPrivateMessageSecondLine',
defaultMessage:
'Are you sure you want to convert {displayName} to a private channel?',
}, },
toPrivateTitle: { toPrivateTitle: {
id: 'admin.team_channel_settings.convertAndRemoveConfirmModal.toPrivateTitle', id: 'admin.team_channel_settings.convertAndRemoveConfirmModal.toPrivateTitle',
defaultMessage: 'Convert channel to private and remove {amount, number} {amount, plural, one {user} other {users}}?', defaultMessage:
'Convert channel to private and remove {amount, number} {amount, plural, one {user} other {users}}?',
}, },
toPublicConfirm: { toPublicConfirm: {
id: 'admin.team_channel_settings.convertAndRemoveConfirmModal.toPublicConfirm', id: 'admin.team_channel_settings.convertAndRemoveConfirmModal.toPublicConfirm',
defaultMessage: 'Yes, convert channel to public and remove {amount, number} {amount, plural, one {user} other {users}}', defaultMessage:
'Yes, convert channel to public and remove {amount, number} {amount, plural, one {user} other {users}}',
}, },
toPublicMessage: { toPublicMessage: {
id: 'admin.team_channel_settings.convertConfirmModal.toPublicMessage', id: 'admin.team_channel_settings.convertConfirmModal.toPublicMessageFirstLine',
defaultMessage:
// This eslint-disable comment can be removed once this component no longer uses FormattedMarkdownMessage 'When you convert {displayName} to a public channel, history and membership are preserved. Public channels are discoverable and can be joined by users on the system without invitation.',
// eslint-disable-next-line formatjs/no-multiple-whitespaces },
defaultMessage: 'When you convert **{displayName}** to a public channel, history and membership are preserved. Public channels are discoverable and can by joined by users on the system without invitation. \n \nAre you sure you want to convert **{displayName}** to a public channel?', toPublicMessageSecondLine: {
id: 'admin.team_channel_settings.convertConfirmModal.toPublicMessageSecondLine',
defaultMessage:
'Are you sure you want to convert {displayName} to a public channel?',
}, },
toPublicTitle: { toPublicTitle: {
id: 'admin.team_channel_settings.convertAndRemoveConfirmModal.toPublicTitle', id: 'admin.team_channel_settings.convertAndRemoveConfirmModal.toPublicTitle',
defaultMessage: 'Convert channel to public and remove {amount, number} {amount, plural, one {user} other {users}}?', defaultMessage:
'Convert channel to public and remove {amount, number} {amount, plural, one {user} other {users}}?',
}, },
}); });

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

@@ -111,11 +111,11 @@ const messages = defineMessages({
defaultMessage: 'Yes, convert to private channel', defaultMessage: 'Yes, convert to private channel',
}, },
toPrivateMessage: { toPrivateMessage: {
id: 'admin.team_channel_settings.convertConfirmModal.toPrivateMessage', id: 'admin.team_channel_settings.convertConfirmModal.toPrivateMessageFirstLine',
defaultMessage: 'When you convert {displayName} to a private channel, history and membership are preserved. Publicly shared files remain accessible to anyone with the link. Membership in a private channel is by invitation only.', defaultMessage: 'When you convert {displayName} to a private channel, history and membership are preserved. Publicly shared files remain accessible to anyone with the link. Membership in a private channel is by invitation only.',
}, },
toPrivateMessageConfirmation: { toPrivateMessageConfirmation: {
id: 'admin.team_channel_settings.convertConfirmModal.toPrivateMessageConfirmation', id: 'admin.team_channel_settings.convertConfirmModal.toPrivateMessageSecondLine',
defaultMessage: 'Are you sure you want to convert {displayName} to a private channel?', defaultMessage: 'Are you sure you want to convert {displayName} to a private channel?',
}, },
toPrivateTitle: { toPrivateTitle: {
@@ -127,11 +127,11 @@ const messages = defineMessages({
defaultMessage: 'Yes, convert to public channel', defaultMessage: 'Yes, convert to public channel',
}, },
toPublicMessage: { toPublicMessage: {
id: 'admin.team_channel_settings.convertConfirmModal.toPublicMessage', id: 'admin.team_channel_settings.convertConfirmModal.toPublicMessageFirstLine',
defaultMessage: 'When you convert {displayName} to a public channel, history and membership are preserved. Public channels are discoverable and can be joined by users on the system without invitation.', defaultMessage: 'When you convert {displayName} to a public channel, history and membership are preserved. Public channels are discoverable and can be joined by users on the system without invitation.',
}, },
toPublicMessageConfirmation: { toPublicMessageConfirmation: {
id: 'admin.team_channel_settings.convertConfirmModal.toPublicMessageConfirmation', id: 'admin.team_channel_settings.convertConfirmModal.toPublicMessageSecondLine',
defaultMessage: 'Are you sure you want to convert {displayName} to a public channel?', defaultMessage: 'Are you sure you want to convert {displayName} to a public channel?',
}, },
toPublicTitle: { toPublicTitle: {

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

@@ -2625,12 +2625,12 @@
"admin.team_channel_settings.convertAndRemoveConfirmModal.toPublicTitle": "Convert channel to public and remove {amount, number} {amount, plural, one {user} other {users}}", "admin.team_channel_settings.convertAndRemoveConfirmModal.toPublicTitle": "Convert channel to public and remove {amount, number} {amount, plural, one {user} other {users}}",
"admin.team_channel_settings.convertConfirmModal.cancel": "No, cancel", "admin.team_channel_settings.convertConfirmModal.cancel": "No, cancel",
"admin.team_channel_settings.convertConfirmModal.toPrivateConfirm": "Yes, convert to private channel", "admin.team_channel_settings.convertConfirmModal.toPrivateConfirm": "Yes, convert to private channel",
"admin.team_channel_settings.convertConfirmModal.toPrivateMessage": "When you convert {displayName} to a private channel, history and membership are preserved. Publicly shared files remain accessible to anyone with the link. Membership in a private channel is by invitation only.", "admin.team_channel_settings.convertConfirmModal.toPrivateMessageFirstLine": "When you convert {displayName} to a private channel, history and membership are preserved. Publicly shared files remain accessible to anyone with the link. Membership in a private channel is by invitation only.",
"admin.team_channel_settings.convertConfirmModal.toPrivateMessageConfirmation": "Are you sure you want to convert {displayName} to a private channel?", "admin.team_channel_settings.convertConfirmModal.toPrivateMessageSecondLine": "Are you sure you want to convert {displayName} to a private channel?",
"admin.team_channel_settings.convertConfirmModal.toPrivateTitle": "Convert {displayName} to a private channel?", "admin.team_channel_settings.convertConfirmModal.toPrivateTitle": "Convert {displayName} to a private channel?",
"admin.team_channel_settings.convertConfirmModal.toPublicConfirm": "Yes, convert to public channel", "admin.team_channel_settings.convertConfirmModal.toPublicConfirm": "Yes, convert to public channel",
"admin.team_channel_settings.convertConfirmModal.toPublicMessage": "When you convert {displayName} to a public channel, history and membership are preserved. Public channels are discoverable and can be joined by users on the system without invitation.", "admin.team_channel_settings.convertConfirmModal.toPublicMessageFirstLine": "When you convert {displayName} to a public channel, history and membership are preserved. Public channels are discoverable and can be joined by users on the system without invitation.",
"admin.team_channel_settings.convertConfirmModal.toPublicMessageConfirmation": "Are you sure you want to convert {displayName} to a public channel?", "admin.team_channel_settings.convertConfirmModal.toPublicMessageSecondLine": "Are you sure you want to convert {displayName} to a public channel?",
"admin.team_channel_settings.convertConfirmModal.toPublicTitle": "Convert {displayName} to a public channel?", "admin.team_channel_settings.convertConfirmModal.toPublicTitle": "Convert {displayName} to a public channel?",
"admin.team_channel_settings.group_list.membersHeader": "Member Count", "admin.team_channel_settings.group_list.membersHeader": "Member Count",
"admin.team_channel_settings.group_list.nameHeader": "Group Name", "admin.team_channel_settings.group_list.nameHeader": "Group Name",
@@ -2649,6 +2649,8 @@
"admin.team_channel_settings.need_groups": "You must add at least one group to manage this team by sync group members.", "admin.team_channel_settings.need_groups": "You must add at least one group to manage this team by sync group members.",
"admin.team_channel_settings.need_groups_channel": "You must add at least one group to manage this channel by sync group members.", "admin.team_channel_settings.need_groups_channel": "You must add at least one group to manage this channel by sync group members.",
"admin.team_channel_settings.removeConfirmModal.messageChannel": "{amount, number} {amount, plural, one {user} other {users}} will be removed. They are not in groups linked to this channel. Are you sure you wish to remove {amount, plural, one {this user} other {these users}}?", "admin.team_channel_settings.removeConfirmModal.messageChannel": "{amount, number} {amount, plural, one {user} other {users}} will be removed. They are not in groups linked to this channel. Are you sure you wish to remove {amount, plural, one {this user} other {these users}}?",
"admin.team_channel_settings.removeConfirmModal.messageChannelFirstLine": "{amount, number} {amount, plural, one {user} other {users}} will be removed. They are not in groups linked to this channel.",
"admin.team_channel_settings.removeConfirmModal.messageChannelSecondLine": "Are you sure you wish to remove these users?",
"admin.team_channel_settings.removeConfirmModal.messageTeam": "{amount, number} {amount, plural, one {user} other {users}} will be removed. They are not in groups linked to this team. Are you sure you wish to remove {amount, plural, one {this user} other {these users}}?", "admin.team_channel_settings.removeConfirmModal.messageTeam": "{amount, number} {amount, plural, one {user} other {users}} will be removed. They are not in groups linked to this team. Are you sure you wish to remove {amount, plural, one {this user} other {these users}}?",
"admin.team_channel_settings.removeConfirmModal.remove": "Save and remove {amount, plural, one {user} other {users}}", "admin.team_channel_settings.removeConfirmModal.remove": "Save and remove {amount, plural, one {user} other {users}}",
"admin.team_channel_settings.removeConfirmModal.title": "Save and remove {amount, number} {amount, plural, one {user} other {users}}?", "admin.team_channel_settings.removeConfirmModal.title": "Save and remove {amount, number} {amount, plural, one {user} other {users}}?",