PLT-5221: Correct error when team description unchanged. (#5055)
Also replace all legacy i18n code in the changed file.
Этот коммит содержится в:
коммит произвёл
Corey Hulen
родитель
0e2b321e6f
Коммит
2010f74a21
@@ -8,60 +8,9 @@ import SettingItemMax from './setting_item_max.jsx';
|
|||||||
import * as Utils from 'utils/utils.jsx';
|
import * as Utils from 'utils/utils.jsx';
|
||||||
import Constants from 'utils/constants.jsx';
|
import Constants from 'utils/constants.jsx';
|
||||||
|
|
||||||
import {intlShape, injectIntl, defineMessages, FormattedMessage, FormattedHTMLMessage} from 'react-intl';
|
import {FormattedMessage} from 'react-intl';
|
||||||
import {updateTeam} from 'actions/team_actions.jsx';
|
import {updateTeam} from 'actions/team_actions.jsx';
|
||||||
|
|
||||||
const holders = defineMessages({
|
|
||||||
dirDisabled: {
|
|
||||||
id: 'general_tab.dirDisabled',
|
|
||||||
defaultMessage: 'Team Directory has been disabled. Please ask a System Admin to enable the Team Directory in the System Console team settings.'
|
|
||||||
},
|
|
||||||
required: {
|
|
||||||
id: 'general_tab.required',
|
|
||||||
defaultMessage: 'This field is required'
|
|
||||||
},
|
|
||||||
chooseName: {
|
|
||||||
id: 'general_tab.chooseName',
|
|
||||||
defaultMessage: 'Please choose a new name for your team'
|
|
||||||
},
|
|
||||||
includeDirTitle: {
|
|
||||||
id: 'general_tab.includeDirTitle',
|
|
||||||
defaultMessage: 'Include this team in the Team Directory'
|
|
||||||
},
|
|
||||||
yes: {
|
|
||||||
id: 'general_tab.yes',
|
|
||||||
defaultMessage: 'Yes'
|
|
||||||
},
|
|
||||||
no: {
|
|
||||||
id: 'general_tab.no',
|
|
||||||
defaultMessage: 'No'
|
|
||||||
},
|
|
||||||
dirOff: {
|
|
||||||
id: 'general_tab.dirOff',
|
|
||||||
defaultMessage: 'Team directory is turned off for this system.'
|
|
||||||
},
|
|
||||||
openInviteTitle: {
|
|
||||||
id: 'general_tab.openInviteTitle',
|
|
||||||
defaultMessage: 'Allow any user with an account on this server to join this team'
|
|
||||||
},
|
|
||||||
codeTitle: {
|
|
||||||
id: 'general_tab.codeTitle',
|
|
||||||
defaultMessage: 'Invite Code'
|
|
||||||
},
|
|
||||||
codeDesc: {
|
|
||||||
id: 'general_tab.codeDesc',
|
|
||||||
defaultMessage: "Click 'Edit' to regenerate Invite Code."
|
|
||||||
},
|
|
||||||
teamNameInfo: {
|
|
||||||
id: 'general_tab.teamNameInfo',
|
|
||||||
defaultMessage: 'Set the name of the team as it appears on your sign-in screen and at the top of the left-hand sidebar.'
|
|
||||||
},
|
|
||||||
teamDescriptionInfo: {
|
|
||||||
id: 'general_tab.teamDescriptionInfo',
|
|
||||||
defaultMessage: 'Team description provides additional information to help users select the right team. Maximum of 50 characters.'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
class GeneralTab extends React.Component {
|
class GeneralTab extends React.Component {
|
||||||
@@ -156,13 +105,12 @@ class GeneralTab extends React.Component {
|
|||||||
var state = {serverError: '', clientError: ''};
|
var state = {serverError: '', clientError: ''};
|
||||||
let valid = true;
|
let valid = true;
|
||||||
|
|
||||||
const {formatMessage} = this.props.intl;
|
|
||||||
const name = this.state.name.trim();
|
const name = this.state.name.trim();
|
||||||
if (!name) {
|
if (!name) {
|
||||||
state.clientError = formatMessage(holders.required);
|
state.clientError = Utils.localizeMessage('general_tab.required', 'This field is required');
|
||||||
valid = false;
|
valid = false;
|
||||||
} else if (name === this.props.team.display_name) {
|
} else if (name === this.props.team.display_name) {
|
||||||
state.clientError = formatMessage(holders.chooseName);
|
state.clientError = Utils.localizeMessage('general_tab.chooseName', 'Please choose a new name for your team');
|
||||||
valid = false;
|
valid = false;
|
||||||
} else {
|
} else {
|
||||||
state.clientError = '';
|
state.clientError = '';
|
||||||
@@ -197,7 +145,7 @@ class GeneralTab extends React.Component {
|
|||||||
if (inviteId) {
|
if (inviteId) {
|
||||||
state.clientError = '';
|
state.clientError = '';
|
||||||
} else {
|
} else {
|
||||||
state.clientError = this.props.intl.fromatMessage(holders.required);
|
state.clientError = Utils.localizeMessage('general_tab.required', 'This field is required');
|
||||||
valid = false;
|
valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,10 +178,9 @@ class GeneralTab extends React.Component {
|
|||||||
var state = {serverError: '', clientError: ''};
|
var state = {serverError: '', clientError: ''};
|
||||||
let valid = true;
|
let valid = true;
|
||||||
|
|
||||||
const {formatMessage} = this.props.intl;
|
|
||||||
const description = this.state.description.trim();
|
const description = this.state.description.trim();
|
||||||
if (description === this.props.team.description) {
|
if (description === this.props.team.description) {
|
||||||
state.clientError = formatMessage(holders.chooseName);
|
state.clientError = Utils.localizeMessage('general_tab.chooseDescription', 'Please choose a new description for your team');
|
||||||
valid = false;
|
valid = false;
|
||||||
} else {
|
} else {
|
||||||
state.clientError = '';
|
state.clientError = '';
|
||||||
@@ -324,8 +271,6 @@ class GeneralTab extends React.Component {
|
|||||||
serverError = this.state.serverError;
|
serverError = this.state.serverError;
|
||||||
}
|
}
|
||||||
|
|
||||||
const {formatMessage} = this.props.intl;
|
|
||||||
|
|
||||||
let openInviteSection;
|
let openInviteSection;
|
||||||
if (this.props.activeSection === 'open_invite') {
|
if (this.props.activeSection === 'open_invite') {
|
||||||
const inputs = [
|
const inputs = [
|
||||||
@@ -372,7 +317,7 @@ class GeneralTab extends React.Component {
|
|||||||
|
|
||||||
openInviteSection = (
|
openInviteSection = (
|
||||||
<SettingItemMax
|
<SettingItemMax
|
||||||
title={formatMessage(holders.openInviteTitle)}
|
title={Utils.localizeMessage('general_tab.openInviteTitle', 'Allow any user with an account on this server to join this team')}
|
||||||
inputs={inputs}
|
inputs={inputs}
|
||||||
submit={this.handleOpenInviteSubmit}
|
submit={this.handleOpenInviteSubmit}
|
||||||
server_error={serverError}
|
server_error={serverError}
|
||||||
@@ -382,14 +327,14 @@ class GeneralTab extends React.Component {
|
|||||||
} else {
|
} else {
|
||||||
let describe = '';
|
let describe = '';
|
||||||
if (this.state.allow_open_invite === true) {
|
if (this.state.allow_open_invite === true) {
|
||||||
describe = formatMessage(holders.yes);
|
describe = Utils.localizeMessage('general_tab.yes', 'Yes');
|
||||||
} else {
|
} else {
|
||||||
describe = formatMessage(holders.no);
|
describe = Utils.localizeMessage('general_tab.no', 'No');
|
||||||
}
|
}
|
||||||
|
|
||||||
openInviteSection = (
|
openInviteSection = (
|
||||||
<SettingItemMin
|
<SettingItemMin
|
||||||
title={formatMessage(holders.openInviteTitle)}
|
title={Utils.localizeMessage('general_tab.openInviteTitle', 'Allow any user with an account on this server to join this team')}
|
||||||
describe={describe}
|
describe={describe}
|
||||||
updateSection={this.onUpdateOpenInviteSection}
|
updateSection={this.onUpdateOpenInviteSection}
|
||||||
/>
|
/>
|
||||||
@@ -427,9 +372,19 @@ class GeneralTab extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className='setting-list__hint'>
|
<div className='setting-list__hint'>
|
||||||
<FormattedHTMLMessage
|
<FormattedMessage
|
||||||
id='general_tab.codeLongDesc'
|
id='general_tab.codeLongDesc'
|
||||||
defaultMessage='The Invite Code is used as part of the URL in the team invitation link created by <strong>Get Team Invite Link</strong> in the main menu. Regenerating creates a new team invitation link and invalidates the previous link.'
|
defaultMessage='The Invite Code is used as part of the URL in the team invitation link created by {getTeamInviteLink} in the main menu. Regenerating creates a new team invitation link and invalidates the previous link.'
|
||||||
|
values={{
|
||||||
|
getTeamInviteLink: (
|
||||||
|
<strong>
|
||||||
|
<FormattedMessage
|
||||||
|
id='general_tab.getTeamInviteLink'
|
||||||
|
defaultMessage='Get Team Invite Link'
|
||||||
|
/>
|
||||||
|
</strong>
|
||||||
|
)
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -437,7 +392,7 @@ class GeneralTab extends React.Component {
|
|||||||
|
|
||||||
inviteSection = (
|
inviteSection = (
|
||||||
<SettingItemMax
|
<SettingItemMax
|
||||||
title={formatMessage(holders.codeTitle)}
|
title={Utils.localizeMessage('general_tab.codeTitle', 'Invite Code')}
|
||||||
inputs={inputs}
|
inputs={inputs}
|
||||||
submit={this.handleInviteIdSubmit}
|
submit={this.handleInviteIdSubmit}
|
||||||
server_error={serverError}
|
server_error={serverError}
|
||||||
@@ -448,8 +403,8 @@ class GeneralTab extends React.Component {
|
|||||||
} else {
|
} else {
|
||||||
inviteSection = (
|
inviteSection = (
|
||||||
<SettingItemMin
|
<SettingItemMin
|
||||||
title={formatMessage(holders.codeTitle)}
|
title={Utils.localizeMessage('general_tab.codeTitle', 'Invite Code')}
|
||||||
describe={formatMessage(holders.codeDesc)}
|
describe={Utils.localizeMessage('general_tab.codeDesc', "Click 'Edit' to regenerate Invite Code.")}
|
||||||
updateSection={this.onUpdateInviteIdSection}
|
updateSection={this.onUpdateInviteIdSection}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@@ -488,11 +443,11 @@ class GeneralTab extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
const nameExtraInfo = <span>{formatMessage(holders.teamNameInfo)}</span>;
|
const nameExtraInfo = <span>{Utils.localizeMessage('general_tab.teamNameInfo', 'Set the name of the team as it appears on your sign-in screen and at the top of the left-hand sidebar.')}</span>;
|
||||||
|
|
||||||
nameSection = (
|
nameSection = (
|
||||||
<SettingItemMax
|
<SettingItemMax
|
||||||
title={formatMessage({id: 'general_tab.teamName'})}
|
title={Utils.localizeMessage('general_tab.teamName', 'Team Name')}
|
||||||
inputs={inputs}
|
inputs={inputs}
|
||||||
submit={this.handleNameSubmit}
|
submit={this.handleNameSubmit}
|
||||||
server_error={serverError}
|
server_error={serverError}
|
||||||
@@ -506,7 +461,7 @@ class GeneralTab extends React.Component {
|
|||||||
|
|
||||||
nameSection = (
|
nameSection = (
|
||||||
<SettingItemMin
|
<SettingItemMin
|
||||||
title={formatMessage({id: 'general_tab.teamName'})}
|
title={Utils.localizeMessage('general_tab.teamName', 'Team Name')}
|
||||||
describe={describe}
|
describe={describe}
|
||||||
updateSection={this.onUpdateNameSection}
|
updateSection={this.onUpdateNameSection}
|
||||||
/>
|
/>
|
||||||
@@ -546,11 +501,11 @@ class GeneralTab extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
const descriptionExtraInfo = <span>{formatMessage(holders.teamDescriptionInfo)}</span>;
|
const descriptionExtraInfo = <span>{Utils.localizeMessage('general_tab.teamDescriptionInfo', 'Team description provides additional information to help users select the right team. Maximum of 50 characters.')}</span>;
|
||||||
|
|
||||||
descriptionSection = (
|
descriptionSection = (
|
||||||
<SettingItemMax
|
<SettingItemMax
|
||||||
title={formatMessage({id: 'general_tab.teamDescription'})}
|
title={Utils.localizeMessage('general_tab.teamDescription', 'Team Description')}
|
||||||
inputs={inputs}
|
inputs={inputs}
|
||||||
submit={this.handleDescriptionSubmit}
|
submit={this.handleDescriptionSubmit}
|
||||||
server_error={serverError}
|
server_error={serverError}
|
||||||
@@ -574,7 +529,7 @@ class GeneralTab extends React.Component {
|
|||||||
|
|
||||||
descriptionSection = (
|
descriptionSection = (
|
||||||
<SettingItemMin
|
<SettingItemMin
|
||||||
title={formatMessage({id: 'general_tab.teamDescription'})}
|
title={Utils.localizeMessage('general_tab.teamDescription', 'Team Description')}
|
||||||
describe={describemsg}
|
describe={describemsg}
|
||||||
updateSection={this.onUpdateDescriptionSection}
|
updateSection={this.onUpdateDescriptionSection}
|
||||||
/>
|
/>
|
||||||
@@ -633,10 +588,9 @@ class GeneralTab extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GeneralTab.propTypes = {
|
GeneralTab.propTypes = {
|
||||||
intl: intlShape.isRequired,
|
|
||||||
updateSection: React.PropTypes.func.isRequired,
|
updateSection: React.PropTypes.func.isRequired,
|
||||||
team: React.PropTypes.object.isRequired,
|
team: React.PropTypes.object.isRequired,
|
||||||
activeSection: React.PropTypes.string.isRequired
|
activeSection: React.PropTypes.string.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
export default injectIntl(GeneralTab);
|
export default GeneralTab;
|
||||||
|
|||||||
@@ -1291,14 +1291,13 @@
|
|||||||
"flag_post.flag": "Flag for follow up",
|
"flag_post.flag": "Flag for follow up",
|
||||||
"flag_post.unflag": "Unflag",
|
"flag_post.unflag": "Unflag",
|
||||||
"general_tab.chooseName": "Please choose a new name for your team",
|
"general_tab.chooseName": "Please choose a new name for your team",
|
||||||
|
"general_tab.chooseDescription": "Please choose a new description for your team",
|
||||||
"general_tab.codeDesc": "Click 'Edit' to regenerate Invite Code.",
|
"general_tab.codeDesc": "Click 'Edit' to regenerate Invite Code.",
|
||||||
"general_tab.codeLongDesc": "The Invite Code is used as part of the URL in the team invitation link created by <strong>Get Team Invite Link</strong> in the main menu. Regenerating creates a new team invitation link and invalidates the previous link.",
|
"general_tab.codeLongDesc": "The Invite Code is used as part of the URL in the team invitation link created by {getTeamInviteLink} in the main menu. Regenerating creates a new team invitation link and invalidates the previous link.",
|
||||||
"general_tab.codeTitle": "Invite Code",
|
"general_tab.codeTitle": "Invite Code",
|
||||||
"general_tab.dirDisabled": "Team Directory has been disabled. Please ask a System Admin to enable the Team Directory in the System Console team settings.",
|
|
||||||
"general_tab.dirOff": "Team directory is turned off for this system.",
|
|
||||||
"general_tab.emptyDescription": "Click 'Edit' to add a team description.",
|
"general_tab.emptyDescription": "Click 'Edit' to add a team description.",
|
||||||
|
"general_tab.getTeamInviteLink": "Get Team Invite Link",
|
||||||
"general_tab.includeDirDesc": "Including this team will display the team name from the Team Directory section of the Home Page, and provide a link to the sign-in page.",
|
"general_tab.includeDirDesc": "Including this team will display the team name from the Team Directory section of the Home Page, and provide a link to the sign-in page.",
|
||||||
"general_tab.includeDirTitle": "Include this team in the Team Directory",
|
|
||||||
"general_tab.no": "No",
|
"general_tab.no": "No",
|
||||||
"general_tab.openInviteDesc": "When allowed, a link to this team will be included on the landing page allowing anyone with an account to join this team.",
|
"general_tab.openInviteDesc": "When allowed, a link to this team will be included on the landing page allowing anyone with an account to join this team.",
|
||||||
"general_tab.openInviteTitle": "Allow any user with an account on this server to join this team",
|
"general_tab.openInviteTitle": "Allow any user with an account on this server to join this team",
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user