From 90cc1f6931a2a13817aeccfc64edcf8354fcb4a5 Mon Sep 17 00:00:00 2001 From: Zubair Imtiaz <106450046+ZubairImtiaz3@users.noreply.github.com> Date: Wed, 23 Oct 2024 10:13:37 +0500 Subject: [PATCH] [MM-60853] Replace FormattedMarkdownMessage in 'webapp/channels/src/components/admin_console/team_channel_settings/convert_and_remove_confirm_modal.tsx' with FormattedMessage (#28718) --- .../convert_and_remove_confirm_modal.tsx | 103 ++++++++++++------ .../convert_confirm_modal.tsx | 8 +- webapp/channels/src/i18n/en.json | 10 +- 3 files changed, 79 insertions(+), 42 deletions(-) diff --git a/webapp/channels/src/components/admin_console/team_channel_settings/convert_and_remove_confirm_modal.tsx b/webapp/channels/src/components/admin_console/team_channel_settings/convert_and_remove_confirm_modal.tsx index e32b18368d..fcbbf7501b 100644 --- a/webapp/channels/src/components/admin_console/team_channel_settings/convert_and_remove_confirm_modal.tsx +++ b/webapp/channels/src/components/admin_console/team_channel_settings/convert_and_remove_confirm_modal.tsx @@ -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 = ( + <>

- {displayName}, + }} />

{displayName}, + }} + /> +

+

+

- +

+ +

+ ); 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}}?', }, }); diff --git a/webapp/channels/src/components/admin_console/team_channel_settings/convert_confirm_modal.tsx b/webapp/channels/src/components/admin_console/team_channel_settings/convert_confirm_modal.tsx index c40b3909d9..fd185c665e 100644 --- a/webapp/channels/src/components/admin_console/team_channel_settings/convert_confirm_modal.tsx +++ b/webapp/channels/src/components/admin_console/team_channel_settings/convert_confirm_modal.tsx @@ -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: { diff --git a/webapp/channels/src/i18n/en.json b/webapp/channels/src/i18n/en.json index dcf298ce07..fb4ee582cc 100644 --- a/webapp/channels/src/i18n/en.json +++ b/webapp/channels/src/i18n/en.json @@ -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}}?",