MM-51977 : Remove inconsistencies of the duplicate IDs with different defaultMessages (#22965)
* eslint format lib to root * eslint fixes * no id rule removed * same rectintl * try 1 * eslint format lib to root * eslint fixes * no id rule removed * same rectintl * react intl in root * type fix * add back version to components * missing translations added * remove type casting * a * type fix formatjs * snaps updated * Update package-lock.json * Update package-lock.json * rem * snapshot updates --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3f022e728f
Коммит
adff327b9c
@@ -10,7 +10,7 @@ exports[`components/integrations/AbstractIncomingWebhook should call action func
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Incoming Webhooks"
|
||||
id="installed_incoming_webhooks.header"
|
||||
id="incoming_webhooks.header"
|
||||
/>
|
||||
</Link>
|
||||
<MemoizedFormattedMessage
|
||||
@@ -271,7 +271,7 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot 1
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Incoming Webhooks"
|
||||
id="installed_incoming_webhooks.header"
|
||||
id="incoming_webhooks.header"
|
||||
/>
|
||||
</Link>
|
||||
<MemoizedFormattedMessage
|
||||
@@ -532,7 +532,7 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot,
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Incoming Webhooks"
|
||||
id="installed_incoming_webhooks.header"
|
||||
id="incoming_webhooks.header"
|
||||
/>
|
||||
</Link>
|
||||
<MemoizedFormattedMessage
|
||||
@@ -796,7 +796,7 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot,
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Incoming Webhooks"
|
||||
id="installed_incoming_webhooks.header"
|
||||
id="incoming_webhooks.header"
|
||||
/>
|
||||
</Link>
|
||||
<MemoizedFormattedMessage
|
||||
@@ -1024,7 +1024,7 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot,
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Incoming Webhooks"
|
||||
id="installed_incoming_webhooks.header"
|
||||
id="incoming_webhooks.header"
|
||||
/>
|
||||
</Link>
|
||||
<MemoizedFormattedMessage
|
||||
@@ -1252,7 +1252,7 @@ exports[`components/integrations/AbstractIncomingWebhook should match snapshot,
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Incoming Webhooks"
|
||||
id="installed_incoming_webhooks.header"
|
||||
id="incoming_webhooks.header"
|
||||
/>
|
||||
</Link>
|
||||
<MemoizedFormattedMessage
|
||||
|
||||
@@ -10,7 +10,7 @@ exports[`components/integrations/AbstractOutgoingWebhook should match snapshot 1
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Outgoing Webhooks"
|
||||
id="installed_outgoing_webhooks.header"
|
||||
id="add_outgoing_webhook.header"
|
||||
/>
|
||||
</Link>
|
||||
<MemoizedFormattedMessage
|
||||
|
||||
@@ -34,7 +34,7 @@ exports[`components/integrations/InstalledOutgoingWebhook should match snapshot
|
||||
onClick={[Function]}
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Regen Token"
|
||||
defaultMessage="Regenerate Token"
|
||||
id="installed_integrations.regenToken"
|
||||
/>
|
||||
</button>
|
||||
|
||||
@@ -184,7 +184,7 @@ export default class AbstractIncomingWebhook extends PureComponent<Props, State>
|
||||
<BackstageHeader>
|
||||
<Link to={`/${this.props.team.name}/integrations/incoming_webhooks`}>
|
||||
<FormattedMessage
|
||||
id='installed_incoming_webhooks.header'
|
||||
id='incoming_webhooks.header'
|
||||
defaultMessage='Incoming Webhooks'
|
||||
/>
|
||||
</Link>
|
||||
|
||||
@@ -249,7 +249,7 @@ export default class AbstractOutgoingWebhook extends React.PureComponent {
|
||||
<BackstageHeader>
|
||||
<Link to={`/${this.props.team.name}/integrations/outgoing_webhooks`}>
|
||||
<FormattedMessage
|
||||
id='installed_outgoing_webhooks.header'
|
||||
id='add_outgoing_webhook.header'
|
||||
defaultMessage='Outgoing Webhooks'
|
||||
/>
|
||||
</Link>
|
||||
|
||||
@@ -0,0 +1,362 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`components/integrations/bots/AddBot blank 1`] = `
|
||||
<div
|
||||
className="backstage-content"
|
||||
>
|
||||
<BackstageHeader>
|
||||
<Link
|
||||
to="/DN/integrations/bots"
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Bot Accounts"
|
||||
id="bots.manage.header"
|
||||
/>
|
||||
</Link>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Add"
|
||||
id="bots.manage.add.add"
|
||||
/>
|
||||
</BackstageHeader>
|
||||
<div
|
||||
className="backstage-form"
|
||||
>
|
||||
<form
|
||||
className="form-horizontal"
|
||||
onSubmit={[Function]}
|
||||
>
|
||||
<div
|
||||
className="form-group"
|
||||
>
|
||||
<label
|
||||
className="control-label col-sm-4"
|
||||
htmlFor="username"
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Username"
|
||||
id="bots.add.username"
|
||||
/>
|
||||
</label>
|
||||
<div
|
||||
className="col-md-5 col-sm-8"
|
||||
>
|
||||
<input
|
||||
className="form-control"
|
||||
id="username"
|
||||
maxLength={22}
|
||||
onChange={[Function]}
|
||||
type="text"
|
||||
value=""
|
||||
/>
|
||||
<div
|
||||
className="form__help"
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="You can use lowercase letters, numbers, periods, dashes, and underscores."
|
||||
id="bot.add.username.help"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="form-group"
|
||||
>
|
||||
<label
|
||||
className="control-label col-sm-4"
|
||||
htmlFor="boticon"
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Bot Icon"
|
||||
id="bots.add.icon"
|
||||
/>
|
||||
</label>
|
||||
<div
|
||||
className="col-md-5 col-sm-8"
|
||||
>
|
||||
<div
|
||||
className="bot-img-container"
|
||||
>
|
||||
<img
|
||||
alt="bot image"
|
||||
className="bot-img"
|
||||
src={null}
|
||||
style={
|
||||
Object {
|
||||
"transform": "",
|
||||
"transformOrigin": "",
|
||||
}
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className="btn btn-sm btn-primary btn-file sel-btn"
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Upload Image"
|
||||
id="bots.image.upload"
|
||||
/>
|
||||
<input
|
||||
accept=".jpeg,.jpg,.png,.bmp"
|
||||
onChange={[Function]}
|
||||
type="file"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="form-group"
|
||||
>
|
||||
<label
|
||||
className="control-label col-sm-4"
|
||||
htmlFor="displayName"
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Display Name"
|
||||
id="bots.add.displayName"
|
||||
/>
|
||||
</label>
|
||||
<div
|
||||
className="col-md-5 col-sm-8"
|
||||
>
|
||||
<input
|
||||
className="form-control"
|
||||
id="displayName"
|
||||
maxLength={64}
|
||||
onChange={[Function]}
|
||||
type="text"
|
||||
value=""
|
||||
/>
|
||||
<div
|
||||
className="form__help"
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="(Optional) You can choose to display your bot's full name rather than its username."
|
||||
id="bot.add.display_name.help"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="form-group"
|
||||
>
|
||||
<label
|
||||
className="control-label col-sm-4"
|
||||
htmlFor="description"
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Description"
|
||||
id="bot.add.description"
|
||||
/>
|
||||
</label>
|
||||
<div
|
||||
className="col-md-5 col-sm-8"
|
||||
>
|
||||
<input
|
||||
className="form-control"
|
||||
id="description"
|
||||
maxLength={1024}
|
||||
onChange={[Function]}
|
||||
type="text"
|
||||
value=""
|
||||
/>
|
||||
<div
|
||||
className="form__help"
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="(Optional) Let others know what this bot does."
|
||||
id="bot.add.description.help"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="form-group"
|
||||
>
|
||||
<label
|
||||
className="control-label col-sm-4"
|
||||
htmlFor="role"
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Role"
|
||||
id="bot.add.role"
|
||||
/>
|
||||
</label>
|
||||
<div
|
||||
className="col-md-5 col-sm-8"
|
||||
>
|
||||
<select
|
||||
className="form-control"
|
||||
disabled={false}
|
||||
onChange={[Function]}
|
||||
value="Member"
|
||||
>
|
||||
<option
|
||||
value="Member"
|
||||
>
|
||||
Member
|
||||
</option>
|
||||
<option
|
||||
value="System Admin"
|
||||
>
|
||||
System Admin
|
||||
</option>
|
||||
</select>
|
||||
<div
|
||||
className="form__help"
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Choose what role the bot should have."
|
||||
id="bot.add.role.help"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="row bot-profile__section"
|
||||
>
|
||||
<div
|
||||
className="col-md-5 col-sm-8 col-sm-offset-4"
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Select additional permissions for the account. <link>Read more about roles and permissions</link>."
|
||||
id="admin.manage_roles.botAdditionalRoles"
|
||||
values={
|
||||
Object {
|
||||
"link": [Function],
|
||||
}
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="form-group"
|
||||
>
|
||||
<label
|
||||
className="control-label col-sm-4"
|
||||
htmlFor="postAll"
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="post:all"
|
||||
id="bot.add.post_all"
|
||||
/>
|
||||
</label>
|
||||
<div
|
||||
className="col-md-5 col-sm-8 checkbox"
|
||||
>
|
||||
<div
|
||||
className="checkbox no-padding"
|
||||
>
|
||||
<label
|
||||
htmlFor="postAll"
|
||||
>
|
||||
<input
|
||||
checked={false}
|
||||
disabled={false}
|
||||
id="postAll"
|
||||
onChange={[Function]}
|
||||
type="checkbox"
|
||||
/>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Enabled"
|
||||
id="bot.add.post_all.enabled"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<div
|
||||
className="form__help"
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Bot will have access to post to all Mattermost channels including direct messages."
|
||||
id="bot.add.post_all.help"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="form-group"
|
||||
>
|
||||
<label
|
||||
className="control-label col-sm-4"
|
||||
htmlFor="postChannels"
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="post:channels"
|
||||
id="bot.add.post_channels"
|
||||
/>
|
||||
</label>
|
||||
<div
|
||||
className="col-md-5 col-sm-8 checkbox"
|
||||
>
|
||||
<div
|
||||
className="checkbox no-padding"
|
||||
>
|
||||
<label
|
||||
htmlFor="postChannels"
|
||||
>
|
||||
<input
|
||||
checked={false}
|
||||
disabled={false}
|
||||
id="postChannels"
|
||||
onChange={[Function]}
|
||||
type="checkbox"
|
||||
/>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Enabled"
|
||||
id="bot.add.post_channels.enabled"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<div
|
||||
className="form__help"
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Bot will have access to post to all Mattermost public channels."
|
||||
id="bot.add.post_channels.help"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="backstage-form__footer"
|
||||
>
|
||||
<FormError
|
||||
error={null}
|
||||
errors={
|
||||
Array [
|
||||
"",
|
||||
]
|
||||
}
|
||||
type="backstage"
|
||||
/>
|
||||
<Link
|
||||
className="btn btn-link btn-sm"
|
||||
to="/DN/integrations/bots"
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Cancel"
|
||||
id="bots.manage.add.cancel"
|
||||
/>
|
||||
</Link>
|
||||
<SpinnerButton
|
||||
className="btn btn-primary"
|
||||
id="saveBot"
|
||||
onClick={[Function]}
|
||||
spinning={false}
|
||||
spinningText={
|
||||
<Memo(MemoizedFormattedMessage)
|
||||
defaultMessage="Creating..."
|
||||
id="bots.manage.add.creating"
|
||||
/>
|
||||
}
|
||||
type="submit"
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Create Bot Account"
|
||||
id="bots.manage.add.create"
|
||||
/>
|
||||
</SpinnerButton>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -3,9 +3,7 @@
|
||||
|
||||
import React from 'react';
|
||||
import {shallow} from 'enzyme';
|
||||
import {FormattedMessage} from 'react-intl';
|
||||
|
||||
// import TestHelper from 'mattermost-redux/test/test_helper';
|
||||
import {TestHelper} from 'utils/test_helper';
|
||||
|
||||
import AddBot from './add_bot';
|
||||
@@ -49,11 +47,7 @@ describe('components/integrations/bots/AddBot', () => {
|
||||
value={''}
|
||||
/>,
|
||||
)).toEqual(true);
|
||||
expect(wrapper.containsMatchingElement(
|
||||
<FormattedMessage
|
||||
id='admin.manage_roles.additionalRoles'
|
||||
/>,
|
||||
)).toEqual(true);
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('edit bot', () => {
|
||||
|
||||
@@ -322,7 +322,7 @@ export default class AddBot extends React.PureComponent<Props, State> {
|
||||
error: (
|
||||
<FormattedMessage
|
||||
id='bots.manage.add.invalid_username'
|
||||
defaultMessage='Usernames must begin with a lowercase letter and be 3-22 characters long. You can use lowercase letters, numbers, periods, dashes, and underscores.'
|
||||
defaultMessage='Usernames have to begin with a lowercase letter and be 3-22 characters long. You can use lowercase letters, numbers, periods, dashes, and underscores.'
|
||||
/>
|
||||
),
|
||||
};
|
||||
@@ -383,7 +383,7 @@ export default class AddBot extends React.PureComponent<Props, State> {
|
||||
render() {
|
||||
let subtitle = (
|
||||
<FormattedMessage
|
||||
id='bots.manage.add'
|
||||
id='bots.manage.add.add'
|
||||
defaultMessage='Add'
|
||||
/>
|
||||
);
|
||||
@@ -630,7 +630,7 @@ export default class AddBot extends React.PureComponent<Props, State> {
|
||||
<div className='row bot-profile__section'>
|
||||
<div className='col-md-5 col-sm-8 col-sm-offset-4'>
|
||||
<FormattedMessage
|
||||
id='admin.manage_roles.additionalRoles'
|
||||
id='admin.manage_roles.botAdditionalRoles'
|
||||
defaultMessage='Select additional permissions for the account. <link>Read more about roles and permissions</link>.'
|
||||
values={{
|
||||
link: (msg: React.ReactNode) => (
|
||||
|
||||
@@ -12,7 +12,7 @@ exports[`components/integrations/ConfirmIntegration should match snapshot, comma
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Slash Commands"
|
||||
id="installed_commands.header"
|
||||
id="slash_commands.header"
|
||||
/>
|
||||
</Link>
|
||||
<MemoizedFormattedMessage
|
||||
@@ -90,7 +90,7 @@ exports[`components/integrations/ConfirmIntegration should match snapshot, incom
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Incoming Webhooks"
|
||||
id="installed_incoming_webhooks.header"
|
||||
id="incoming_webhooks.header"
|
||||
/>
|
||||
</Link>
|
||||
<MemoizedFormattedMessage
|
||||
@@ -168,7 +168,7 @@ exports[`components/integrations/ConfirmIntegration should match snapshot, oauth
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="OAuth 2.0 Applications"
|
||||
id="installed_oauth_apps.header"
|
||||
id="installed_oauth2_apps.header"
|
||||
/>
|
||||
</Link>
|
||||
<MemoizedFormattedMessage
|
||||
@@ -286,7 +286,7 @@ exports[`components/integrations/ConfirmIntegration should match snapshot, outgo
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Outgoing Webhooks"
|
||||
id="installed_outgoing_webhooks.header"
|
||||
id="add_outgoing_webhook.header"
|
||||
/>
|
||||
</Link>
|
||||
<MemoizedFormattedMessage
|
||||
|
||||
@@ -63,7 +63,7 @@ const ConfirmIntegration = ({team, location, commands, oauthApps, incomingHooks,
|
||||
|
||||
headerText = (
|
||||
<FormattedMessage
|
||||
id={'installed_commands.header'}
|
||||
id={'slash_commands.header'}
|
||||
defaultMessage='Slash Commands'
|
||||
/>
|
||||
);
|
||||
@@ -100,7 +100,7 @@ const ConfirmIntegration = ({team, location, commands, oauthApps, incomingHooks,
|
||||
|
||||
headerText = (
|
||||
<FormattedMessage
|
||||
id={'installed_incoming_webhooks.header'}
|
||||
id={'incoming_webhooks.header'}
|
||||
defaultMessage='Incoming Webhooks'
|
||||
/>
|
||||
);
|
||||
@@ -137,7 +137,7 @@ const ConfirmIntegration = ({team, location, commands, oauthApps, incomingHooks,
|
||||
|
||||
headerText = (
|
||||
<FormattedMessage
|
||||
id={'installed_outgoing_webhooks.header'}
|
||||
id={'add_outgoing_webhook.header'}
|
||||
defaultMessage='Outgoing Webhooks'
|
||||
/>
|
||||
);
|
||||
@@ -175,7 +175,7 @@ const ConfirmIntegration = ({team, location, commands, oauthApps, incomingHooks,
|
||||
|
||||
headerText = (
|
||||
<FormattedMessage
|
||||
id={'installed_oauth_apps.header'}
|
||||
id={'installed_oauth2_apps.header'}
|
||||
defaultMessage='OAuth 2.0 Applications'
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -20,7 +20,7 @@ exports[`components/integrations/InstalledOAuthApps should match snapshot 1`] =
|
||||
header={
|
||||
<Memo(MemoizedFormattedMessage)
|
||||
defaultMessage="OAuth 2.0 Applications"
|
||||
id="installed_oauth_apps.header"
|
||||
id="installed_oauth2_apps.header"
|
||||
/>
|
||||
}
|
||||
helpText={
|
||||
|
||||
@@ -134,7 +134,7 @@ export default class InstalledOAuthApps extends React.PureComponent<Props, State
|
||||
<BackstageList
|
||||
header={
|
||||
<FormattedMessage
|
||||
id='installed_oauth_apps.header'
|
||||
id='installed_oauth2_apps.header'
|
||||
defaultMessage='OAuth 2.0 Applications'
|
||||
/>
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ export default class InstalledOutgoingWebhook extends React.PureComponent<Props>
|
||||
>
|
||||
<FormattedMessage
|
||||
id='installed_integrations.regenToken'
|
||||
defaultMessage='Regen Token'
|
||||
defaultMessage='Regenerate Token'
|
||||
/>
|
||||
</button>
|
||||
{' - '}
|
||||
|
||||
Ссылка в новой задаче
Block a user