Skip to content

Commit

Permalink
fix JS errors on system console and channel intro message (mattermost…
Browse files Browse the repository at this point in the history
  • Loading branch information
saturninoabril committed Jun 6, 2019
1 parent 2d26f59 commit 5dd2b25
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
30 changes: 22 additions & 8 deletions components/admin_console/help_text.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export default class HelpText extends React.PureComponent {
static propTypes = {
isMarkdown: PropTypes.bool,
isTranslated: PropTypes.bool,
text: PropTypes.string.isRequired,
text: PropTypes.oneOfType([
PropTypes.string,
PropTypes.object,
]).isRequired,
textDefault: PropTypes.string,
textValues: PropTypes.object,
};
Expand All @@ -22,21 +25,32 @@ export default class HelpText extends React.PureComponent {
};

renderTranslated = () => {
if (this.props.isMarkdown) {
const {
isMarkdown,
text,
textDefault,
textValues,
} = this.props;

if (typeof text === 'object') {
return text;
}

if (isMarkdown) {
return (
<FormattedMarkdownMessage
id={this.props.text}
defaultMessage={this.props.textDefault}
values={this.props.textValues}
id={text}
defaultMessage={textDefault}
values={textValues}
/>
);
}

return (
<FormattedMessage
id={this.props.text}
values={this.props.textValues}
defaultMessage={this.props.textDefault}
id={text}
values={textValues}
defaultMessage={textDefault}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class ChannelIntroMessage extends React.PureComponent {
channelProfiles: PropTypes.array.isRequired,
enableUserCreation: PropTypes.bool,
isReadOnly: PropTypes.bool,
teamIsGroupConstrained: PropTypes.bool.isRequired,
teamIsGroupConstrained: PropTypes.bool,
};

render() {
Expand Down

0 comments on commit 5dd2b25

Please sign in to comment.