[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 ConfirmModal from 'components/confirm_modal';
import FormattedMarkdownMessage from 'components/formatted_markdown_message';
type Props = {
@@ -40,19 +39,29 @@ type Props = {
removeAmount: number;
};
const ConvertAndRemoveConfirmModal = ({show, onConfirm, onCancel, displayName, toPublic, removeAmount}: Props) => {
let titleMessage;
let convertMessage;
let confirmMessage;
if (toPublic) {
titleMessage = messages.toPublicTitle;
convertMessage = messages.toPublicMessage;
confirmMessage = messages.toPublicConfirm;
} else {
titleMessage = messages.toPrivateTitle;
convertMessage = messages.toPrivateMessage;
confirmMessage = messages.toPrivateConfirm;
}
const ConvertAndRemoveConfirmModal = ({
show,
onConfirm,
onCancel,
displayName,
toPublic,
removeAmount,
}: Props) => {
const titleMessage = toPublic ?
messages.toPublicTitle :
messages.toPrivateTitle;
const convertMessage = toPublic ?
messages.toPublicMessage :
messages.toPrivateMessage;
const convertMessageSecondLine = toPublic ?
messages.toPublicMessageSecondLine :
messages.toPrivateMessageSecondLine;
const confirmMessage = toPublic ?
messages.toPublicConfirm :
messages.toPrivateConfirm;
const title = (
<FormattedMessage
@@ -62,21 +71,37 @@ const ConvertAndRemoveConfirmModal = ({show, onConfirm, onCancel, displayName, t
);
const message = (
<div>
<>
<p>
<FormattedMarkdownMessage
<FormattedMessage
{...convertMessage}
values={{displayName}}
values={{
displayName: <strong>{displayName}</strong>,
}}
/>
</p>
<p>
<FormattedMessage
id='admin.team_channel_settings.removeConfirmModal.messageChannel'
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?'
{...convertMessageSecondLine}
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}}
/>
</p>
</div>
<p>
<FormattedMessage
id='admin.team_channel_settings.removeConfirmModal.messageChannelSecondLine'
defaultMessage='Are you sure you wish to remove these users?'
/>
</p>
</>
);
const confirmButton = (
@@ -113,33 +138,43 @@ const ConvertAndRemoveConfirmModal = ({show, onConfirm, onCancel, displayName, t
const messages = defineMessages({
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: {
id: 'admin.team_channel_settings.convertConfirmModal.toPrivateMessage',
// This eslint-disable comment can be removed once this component no longer uses FormattedMarkdownMessage
// 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?',
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.',
},
toPrivateMessageSecondLine: {
id: 'admin.team_channel_settings.convertConfirmModal.toPrivateMessageSecondLine',
defaultMessage:
'Are you sure you want to convert {displayName} to a private channel?',
},
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: {
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: {
id: 'admin.team_channel_settings.convertConfirmModal.toPublicMessage',
// This eslint-disable comment can be removed once this component no longer uses FormattedMarkdownMessage
// 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?',
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.',
},
toPublicMessageSecondLine: {
id: 'admin.team_channel_settings.convertConfirmModal.toPublicMessageSecondLine',
defaultMessage:
'Are you sure you want to convert {displayName} to a public channel?',
},
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',
},
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.',
},
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?',
},
toPrivateTitle: {
@@ -127,11 +127,11 @@ const messages = defineMessages({
defaultMessage: 'Yes, convert to public channel',
},
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.',
},
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?',
},
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.convertConfirmModal.cancel": "No, cancel",
"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.toPrivateMessageConfirmation": "Are you sure you want to convert {displayName} to a private channel?",
"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.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.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.toPublicMessageConfirmation": "Are you sure you want to convert {displayName} to a public channel?",
"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.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.group_list.membersHeader": "Member Count",
"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_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.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.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}}?",