Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

[MM-19193] Fix basename in paths to System Console #3885

Merged
merged 9 commits into from
Oct 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default class ConfigurationAnnouncementBar extends React.PureComponent {
canViewSystemErrors: PropTypes.bool.isRequired,
totalUsers: PropTypes.number,
dismissedExpiringLicense: PropTypes.bool,
siteURL: PropTypes.string.isRequired,
actions: PropTypes.shape({
dismissNotice: PropTypes.func.isRequired,
}).isRequired,
Expand Down Expand Up @@ -137,13 +138,14 @@ export default class ConfigurationAnnouncementBar extends React.PureComponent {
let defaultMessage;
if (this.props.config.EnableSignUpWithGitLab === 'true') {
id = t('announcement_bar.error.site_url_gitlab.full');
defaultMessage = 'Please configure your [Site URL](https://docs.mattermost.com/administration/config-settings.html#site-url) in the [System Console](/admin_console/environment/web_server) or in gitlab.rb if you\'re using GitLab Mattermost.';
defaultMessage = 'Please configure your [Site URL](https://docs.mattermost.com/administration/config-settings.html#site-url) in the [System Console]({siteURL}/admin_console/environment/web_server) or in gitlab.rb if you\'re using GitLab Mattermost.';
} else {
id = t('announcement_bar.error.site_url.full');
defaultMessage = 'Please configure your [Site URL](https://docs.mattermost.com/administration/config-settings.html#site-url) in the [System Console](/admin_console/environment/web_server).';
defaultMessage = 'Please configure your [Site URL](https://docs.mattermost.com/administration/config-settings.html#site-url) in the [System Console]({siteURL}/admin_console/environment/web_server).';
}

const siteURLMessage = formatMessage({id, defaultMessage});
const values = {siteURL: this.props.siteURL};
const siteURLMessage = formatMessage({id, defaultMessage}, values);

return (
<TextDismissableBar
Expand Down
2 changes: 2 additions & 0 deletions components/announcement_bar/configuration_bar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import {bindActionCreators} from 'redux';

import {AnnouncementBarMessages} from 'utils/constants.jsx';
import {dismissNotice} from 'actions/views/notice';
import {getSiteURL} from 'utils/url.jsx';

import ConfigurationBar from './configuration_bar.jsx';

function mapStateToProps(state) {
return {
siteURL: getSiteURL(state),
dismissedExpiringLicense: Boolean(state.views.notice.hasBeenDismissed[AnnouncementBarMessages.LICENSE_EXPIRING]),
};
}
Expand Down
5 changes: 4 additions & 1 deletion components/integrations/bots/bots.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,10 @@ export default class Bots extends React.PureComponent {
/>
<FormattedMarkdownMessage
id='bots.manage.help2'
defaultMessage={'Enable bot account creation in the [System Console](' + getSiteURL() + '/admin_console/integrations/bot_accounts).'}
defaultMessage={'Enable bot account creation in the [System Console]({siteURL}/admin_console/integrations/bot_accounts).'}
values={{
siteURL: getSiteURL(),
}}
/>
</React.Fragment>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ exports[`components/MarketplaceModal should match the snapshot, error banner is
>
<div
className="error-bar"
dangerouslySetInnerHTML={
Object {
"__html": "<p>Error connecting to the marketplace server. Please check your settings in the <a class=\\"theme markdown__link\\" href=\\"/admin_console/plugins/plugin_management\\" rel=\\"noreferrer\\" data-link=\\"/admin_console/plugins/plugin_management\\">System Console</a>.</p>",
}
}
id="error_bar"
/>
>
<InjectIntl(FormattedMarkdownMessage)
defaultMessage="Error connecting to the marketplace server. Please check your settings in the [System Console]({siteURL}/admin_console/plugins/plugin_management)."
id="app.plugin.marketplace_plugins.app_error"
values={
Object {
"siteURL": "https://example.com",
}
}
/>
</div>
<div
className="modal-marketplace"
id="modal_marketplace"
Expand Down
2 changes: 2 additions & 0 deletions components/plugin_marketplace/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {getMarketplaceInstalledPlugins} from 'mattermost-redux/selectors/entitie

import {isModalOpen} from 'selectors/views/modals';
import {ModalIdentifiers} from 'utils/constants';
import {getSiteURL} from 'utils/url.jsx';

import {closeModal} from 'actions/views/modals';

Expand All @@ -19,6 +20,7 @@ function mapStateToProps(state) {
show: isModalOpen(state, ModalIdentifiers.PLUGIN_MARKETPLACE),
installedPlugins: getMarketplaceInstalledPlugins(state),
marketplacePlugins: state.entities.plugins.marketplacePlugins,
siteURL: getSiteURL(state),
pluginStatuses: state.entities.admin.pluginStatuses,
};
}
Expand Down
13 changes: 9 additions & 4 deletions components/plugin_marketplace/marketplace_modal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import QuickInput from 'components/quick_input';
import LocalizedInput from 'components/localized_input/localized_input';
import PluginIcon from 'components/widgets/icons/plugin_icon.jsx';
import LoadingScreen from 'components/loading_screen';
import FormattedMarkdownMessage from 'components/formatted_markdown_message.jsx';

import {trackEvent} from 'actions/diagnostics_actions.jsx';
import {t} from 'utils/i18n';
import {localizeMessage} from 'utils/utils';
import * as Markdown from 'utils/markdown';

import MarketplaceItem from './marketplace_item';

Expand All @@ -36,6 +36,7 @@ export default class MarketplaceModal extends React.Component {
show: PropTypes.bool,
installedPlugins: PropTypes.array.isRequired,
marketplacePlugins: PropTypes.array.isRequired,
siteURL: PropTypes.string.isRequired,
pluginStatuses: PropTypes.object.isRequired,
actions: PropTypes.shape({
closeModal: PropTypes.func.isRequired,
Expand Down Expand Up @@ -179,9 +180,13 @@ export default class MarketplaceModal extends React.Component {
<div
className='error-bar'
id='error_bar'
dangerouslySetInnerHTML={{__html: Markdown.format(localizeMessage('app.plugin.marketplace_plugins.app_error',
'Error connecting to the marketplace server. Please check your settings in the [System Console](/admin_console/plugins/plugin_management).'))}}
/>
>
<FormattedMarkdownMessage
id='app.plugin.marketplace_plugins.app_error'
defaultMessage='Error connecting to the marketplace server. Please check your settings in the [System Console]({siteURL}/admin_console/plugins/plugin_management).'
values={{siteURL: this.props.siteURL}}
/>
</div>
);
}

Expand Down
12 changes: 7 additions & 5 deletions components/plugin_marketplace/marketplace_modal.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// See LICENSE.txt for license information.

import React from 'react';
import {shallow} from 'enzyme';

import {shallowWithIntl} from 'tests/helpers/intl-test-helper.jsx';

import MarketplaceModal from './marketplace_modal.jsx';

Expand All @@ -29,6 +30,7 @@ describe('components/MarketplaceModal', () => {
installedPlugins,
marketplacePlugins: marketplacePluginsSample,
pluginStatuses: {},
siteURL: 'https://example.com',
actions: {
closeModal: jest.fn(),
getMarketplacePlugins: jest.fn(),
Expand All @@ -37,7 +39,7 @@ describe('components/MarketplaceModal', () => {
});

test('should match the snapshot, no plugins installed', () => {
const wrapper = shallow(
const wrapper = shallowWithIntl(
<MarketplaceModal {...defaultProps}/>
);
expect(wrapper).toMatchSnapshot();
Expand All @@ -60,7 +62,7 @@ describe('components/MarketplaceModal', () => {
marketplacePluginsSample.push(installedPlugin);
installedPlugins.push(installedPlugin);

const wrapper = shallow(
const wrapper = shallowWithIntl(
<MarketplaceModal {...defaultProps}/>
);

Expand All @@ -69,7 +71,7 @@ describe('components/MarketplaceModal', () => {

test('should fetch marketplace plugins when plugin status is changed', () => {
const getMarketplacePlugins = defaultProps.actions.getMarketplacePlugins;
const wrapper = shallow(<MarketplaceModal {...defaultProps}/>);
const wrapper = shallowWithIntl(<MarketplaceModal {...defaultProps}/>);

expect(getMarketplacePlugins).toBeCalledTimes(1);
wrapper.setProps({...defaultProps});
Expand All @@ -80,7 +82,7 @@ describe('components/MarketplaceModal', () => {
});

test('should match the snapshot, error banner is shown', () => {
const wrapper = shallow(
const wrapper = shallowWithIntl(
<MarketplaceModal {...defaultProps}/>
);

Expand Down
6 changes: 3 additions & 3 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1699,8 +1699,8 @@
"announcement_bar.error.license_expiring": "Enterprise license expires on {date, date, long}. [Please renew](!{link}).",
"announcement_bar.error.past_grace": "Enterprise license is expired and some features may be disabled. Please contact your System Administrator for details.",
"announcement_bar.error.preview_mode": "Preview Mode: Email notifications have not been configured",
"announcement_bar.error.site_url_gitlab.full": "Please configure your [Site URL](https://docs.mattermost.com/administration/config-settings.html#site-url) in the [System Console](/admin_console/environment/web_server) or in gitlab.rb if you're using GitLab Mattermost.",
"announcement_bar.error.site_url.full": "Please configure your [Site URL](https://docs.mattermost.com/administration/config-settings.html#site-url) in the [System Console](/admin_console/environment/web_server).",
"announcement_bar.error.site_url_gitlab.full": "Please configure your [Site URL](https://docs.mattermost.com/administration/config-settings.html#site-url) in the [System Console]({siteURL}/admin_console/environment/web_server) or in gitlab.rb if you're using GitLab Mattermost.",
"announcement_bar.error.site_url.full": "Please configure your [Site URL](https://docs.mattermost.com/administration/config-settings.html#site-url) in the [System Console]({siteURL}/admin_console/environment/web_server).",
"announcement_bar.notification.email_verified": "Email verified",
"api.channel.add_guest.added": "{addedUsername} added to the channel as a guest by {username}.",
"api.channel.add_member.added": "{addedUsername} added to the channel by {username}.",
Expand All @@ -1721,7 +1721,7 @@
"app.channel.post_update_channel_purpose_message.removed": "{username} removed the channel purpose (was: {old})",
"app.channel.post_update_channel_purpose_message.updated_from": "{username} updated the channel purpose from: {old} to: {new}",
"app.channel.post_update_channel_purpose_message.updated_to": "{username} updated the channel purpose to: {new}",
"app.plugin.marketplace_plugins.app_error": "Error connecting to the marketplace server. Please check your settings in the [System Console](/admin_console/plugins/plugin_management).",
"app.plugin.marketplace_plugins.app_error": "Error connecting to the marketplace server. Please check your settings in the [System Console]({siteURL}/admin_console/plugins/plugin_management).",
"archivedChannelMessage": "You are viewing an **archived channel**. New messages cannot be posted.",
"atmos/camo": "atmos/camo",
"audit_table.accountActive": "Account activated",
Expand Down