Skip to content

Commit

Permalink
[MM-60788] Replace FormattedMarkdownMessage in custom_enable_disable_…
Browse files Browse the repository at this point in the history
…guest_accounts_setting, delete_channel_modal, signup.tsx & create_comment.tsx (mattermost#28438)
  • Loading branch information
M-ZubairAhmed authored Oct 11, 2024
1 parent 7895000 commit 276b56d
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,13 @@ exports[`components/AdminConsole/CustomEnableDisableGuestAccountsSetting renders
class="help-text"
data-testid="MySettinghelp-text"
>
<span>
When true, external guest can be invited to channels within teams. Please see
<a
href="../user_management/permissions/system_scheme"
rel="noopener noreferrer"
target="_blank"
>
Permissions Schemes
</a>
for which roles can invite guests.
</span>
When true, external guest can be invited to channels within teams. Please see
<a
href="/admin_console/user_management/permissions/system_scheme"
>
Permissions Schemes
</a>
for which roles can invite guests.
</div>
</div>
</div>
Expand Down Expand Up @@ -111,17 +107,13 @@ exports[`components/AdminConsole/CustomEnableDisableGuestAccountsSetting renders
class="help-text"
data-testid="MySettinghelp-text"
>
<span>
When true, external guest can be invited to channels within teams. Please see
<a
href="../user_management/permissions/system_scheme"
rel="noopener noreferrer"
target="_blank"
>
Permissions Schemes
</a>
for which roles can invite guests.
</span>
When true, external guest can be invited to channels within teams. Please see
<a
href="/admin_console/user_management/permissions/system_scheme"
>
Permissions Schemes
</a>
for which roles can invite guests.
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import React, {useCallback} from 'react';
import {FormattedMessage} from 'react-intl';
import {Link} from 'react-router-dom';

import ConfirmModal from 'components/confirm_modal';
import FormattedMarkdownMessage from 'components/formatted_markdown_message';

import BooleanSetting from './boolean_setting';

Expand Down Expand Up @@ -54,9 +54,12 @@ const CustomEnableDisableGuestAccountsSetting = ({
);

const helpText = (
<FormattedMarkdownMessage
id='admin.guest_access.enableDescription'
defaultMessage='When true, external guest can be invited to channels within teams. Please see [Permissions Schemes](../user_management/permissions/system_scheme) for which roles can invite guests.'
<FormattedMessage
id='admin.guest_access.helpText'
defaultMessage='When true, external guest can be invited to channels within teams. Please see <a>Permissions Schemes</a> for which roles can invite guests.'
values={{
a: (chunks: string) => <Link to='/admin_console/user_management/permissions/system_scheme'>{chunks}</Link>,
}}
/>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,24 @@ exports[`components/delete_channel_modal should match snapshot for delete_channe
<div
className="alert alert-danger"
>
<FormattedMarkdownMessage
defaultMessage="This will archive the channel from the team and remove it from the user interface. Archived channels can be unarchived if needed again. \\\\n \\\\nAre you sure you wish to archive the {display_name} channel?"
id="delete_channel.question"
values={
Object {
"display_name": "testing",
<p>
<MemoizedFormattedMessage
defaultMessage="This will archive the channel from the team and remove it from the user interface. Archived channels can be unarchived if needed again."
id="deleteChannelModal.cannotViewArchivedChannelsWarning"
/>
</p>
<p>
<MemoizedFormattedMessage
defaultMessage="Are you sure you wish to archive the <strong>{display_name}</strong> channel?"
id="deleteChannelModal.confirmArchive"
values={
Object {
"display_name": "testing",
"strong": [Function],
}
}
}
/>
/>
</p>
</div>
</ModalBody>
<ModalFooter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import {FormattedMessage} from 'react-intl';

import type {Channel} from '@mattermost/types/channels';

import FormattedMarkdownMessage from 'components/formatted_markdown_message';

import {getHistory} from 'utils/browser_history';
import Constants from 'utils/constants';

Expand Down Expand Up @@ -77,21 +75,45 @@ export default class DeleteChannelModal extends React.PureComponent<Props, State
<Modal.Body>
<div className='alert alert-danger'>
{!canViewArchivedChannels &&
<FormattedMarkdownMessage
id='delete_channel.question'
defaultMessage='This will archive the channel from the team and remove it from the user interface. Archived channels can be unarchived if needed again. \n \nAre you sure you wish to archive the {display_name} channel?'
values={{
display_name: this.props.channel.display_name,
}}
/>}
<>
<p>
<FormattedMessage
id='deleteChannelModal.cannotViewArchivedChannelsWarning'
defaultMessage='This will archive the channel from the team and remove it from the user interface. Archived channels can be unarchived if needed again.'
/>
</p>
<p>
<FormattedMessage
id='deleteChannelModal.confirmArchive'
defaultMessage='Are you sure you wish to archive the <strong>{display_name}</strong> channel?'
values={{
display_name: this.props.channel.display_name,
strong: (chunks: string) => <strong>{chunks}</strong>,
}}
/>
</p>
</>
}
{canViewArchivedChannels &&
<FormattedMarkdownMessage
id='delete_channel.viewArchived.question'
defaultMessage={'This will archive the channel from the team. Channel contents will still be accessible by channel members.\n \nAre you sure you wish to archive the **{display_name}** channel?'}
values={{
display_name: this.props.channel.display_name,
}}
/>}
<>
<p>
<FormattedMessage
id='deleteChannelModal.canViewArchivedChannelsWarning'
defaultMessage='This will archive the channel from the team. Channel contents will still be accessible by channel members.'
/>
</p>
<p>
<FormattedMessage
id='deleteChannelModal.confirmArchive'
defaultMessage='Are you sure you wish to archive the <strong>{display_name}</strong> channel?'
values={{
display_name: this.props.channel.display_name,
strong: (chunks: string) => <strong>{chunks}</strong>,
}}
/>
</p>
</>
}
</div>
</Modal.Body>
<Modal.Footer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,14 @@ exports[`components/signup/Signup should match snapshot for all signup options e
<p
className="signup-body-card-agreement"
>
<FormattedMarkdownMessage
defaultMessage="By proceeding to create your account and use {siteName}, you agree to our [Terms of Use]({TermsOfServiceLink}) and [Privacy Policy]({PrivacyPolicyLink}). If you do not agree, you cannot use {siteName}."
id="create_team.agreement"
<MemoizedFormattedMessage
defaultMessage="By proceeding to create your account and use {siteName}, you agree to our <termsOfUseLink>Terms of Use</termsOfUseLink> and <privacyPolicyLink>Privacy Policy</privacyPolicyLink>. If you do not agree, you cannot use {siteName}."
id="signup.agreement"
values={
Object {
"PrivacyPolicyLink": "!undefined",
"TermsOfServiceLink": "!undefined",
"privacyPolicyLink": [Function],
"siteName": "Mattermost",
"termsOfUseLink": [Function],
}
}
/>
Expand Down Expand Up @@ -450,14 +450,14 @@ exports[`components/signup/Signup should match snapshot for all signup options e
<p
className="signup-body-card-agreement"
>
<FormattedMarkdownMessage
defaultMessage="By proceeding to create your account and use {siteName}, you agree to our [Terms of Use]({TermsOfServiceLink}) and [Privacy Policy]({PrivacyPolicyLink}). If you do not agree, you cannot use {siteName}."
id="create_team.agreement"
<MemoizedFormattedMessage
defaultMessage="By proceeding to create your account and use {siteName}, you agree to our <termsOfUseLink>Terms of Use</termsOfUseLink> and <privacyPolicyLink>Privacy Policy</privacyPolicyLink>. If you do not agree, you cannot use {siteName}."
id="signup.agreement"
values={
Object {
"PrivacyPolicyLink": "!undefined",
"TermsOfServiceLink": "!undefined",
"privacyPolicyLink": [Function],
"siteName": "Mattermost",
"termsOfUseLink": [Function],
}
}
/>
Expand Down
27 changes: 20 additions & 7 deletions webapp/channels/src/components/signup/signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import classNames from 'classnames';
import throttle from 'lodash/throttle';
import React, {useState, useEffect, useRef, useCallback} from 'react';
import type {FocusEvent} from 'react';
import {useIntl} from 'react-intl';
import {FormattedMessage, useIntl} from 'react-intl';
import {useSelector, useDispatch} from 'react-redux';
import {useLocation, useHistory, Route} from 'react-router-dom';

Expand Down Expand Up @@ -36,7 +36,6 @@ import DesktopAuthToken from 'components/desktop_auth_token';
import ExternalLink from 'components/external_link';
import ExternalLoginButton from 'components/external_login_button/external_login_button';
import type {ExternalLoginButtonType} from 'components/external_login_button/external_login_button';
import FormattedMarkdownMessage from 'components/formatted_markdown_message';
import AlternateLinkLayout from 'components/header_footer_route/content_layouts/alternate_link';
import ColumnLayout from 'components/header_footer_route/content_layouts/column';
import type {CustomizeHeaderType} from 'components/header_footer_route/header_footer_route';
Expand Down Expand Up @@ -893,13 +892,27 @@ const Signup = ({onCustomizeHeader}: SignupProps) => {
)}
{enableSignUpWithEmail && !serverError && (
<p className='signup-body-card-agreement'>
<FormattedMarkdownMessage
id='create_team.agreement'
defaultMessage='By proceeding to create your account and use {siteName}, you agree to our [Terms of Use]({TermsOfServiceLink}) and [Privacy Policy]({PrivacyPolicyLink}). If you do not agree, you cannot use {siteName}.'
<FormattedMessage
id='signup.agreement'
defaultMessage='By proceeding to create your account and use {siteName}, you agree to our <termsOfUseLink>Terms of Use</termsOfUseLink> and <privacyPolicyLink>Privacy Policy</privacyPolicyLink>. If you do not agree, you cannot use {siteName}.'
values={{
siteName: SiteName,
TermsOfServiceLink: `!${TermsOfServiceLink}`,
PrivacyPolicyLink: `!${PrivacyPolicyLink}`,
termsOfUseLink: (chunks: string) => (
<ExternalLink
href={TermsOfServiceLink as string}
location='signup-terms-of-use'
>
{chunks}
</ExternalLink>
),
privacyPolicyLink: (chunks: string) => (
<ExternalLink
href={PrivacyPolicyLink as string}
location='signup-privacy-policy'
>
{chunks}
</ExternalLink>
),
}}
/>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See LICENSE.txt for license information.

import React, {memo, forwardRef, useMemo} from 'react';
import {FormattedMessage} from 'react-intl';
import {useSelector} from 'react-redux';

import {ArchiveOutlineIcon} from '@mattermost/compass-icons/components';
Expand All @@ -11,7 +12,6 @@ import {makeGetChannel} from 'mattermost-redux/selectors/entities/channels';
import {getPost, getLimitedViews} from 'mattermost-redux/selectors/entities/posts';

import AdvancedCreateComment from 'components/advanced_create_comment';
import FormattedMarkdownMessage from 'components/formatted_markdown_message';
import BasicSeparator from 'components/widgets/separator/basic-separator';

import Constants from 'utils/constants';
Expand Down Expand Up @@ -53,9 +53,12 @@ const CreateComment = forwardRef<HTMLDivElement, Props>(({
<div
className='post-create-message'
>
<FormattedMarkdownMessage
id='create_post.deactivated'
defaultMessage='You are viewing an archived channel with a **deactivated user**. New messages cannot be posted.'
<FormattedMessage
id='createComment.threadFromDeactivatedUserMessage'
defaultMessage='You are viewing an archived channel with a <strong>deactivated user</strong>. New messages cannot be posted.'
values={{
strong: (chunks: string) => <strong>{chunks}</strong>,
}}
/>
</div>
);
Expand All @@ -74,9 +77,12 @@ const CreateComment = forwardRef<HTMLDivElement, Props>(({
size={20}
color={'rgba(var(--center-channel-color-rgb), 0.75)'}
/>
<FormattedMarkdownMessage
id='threadFromArchivedChannelMessage'
defaultMessage='You are viewing a thread from an **archived channel**. New messages cannot be posted.'
<FormattedMessage
id='createComment.threadFromArchivedChannelMessage'
defaultMessage='You are viewing a thread from an <strong>archived channel</strong>. New messages cannot be posted.'
values={{
strong: (chunks: string) => <strong>{chunks}</strong>,
}}
/>
</div>
</div>
Expand Down
Loading

0 comments on commit 276b56d

Please sign in to comment.