[MM-53086] Remove SendWelcomePost A/B test and feature (#23733)
Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
@@ -87,8 +87,6 @@ import {UserProfile} from '@mattermost/types/users';
|
||||
|
||||
import {ActionResult} from 'mattermost-redux/types/actions';
|
||||
|
||||
import WelcomePostRenderer from 'components/welcome_post_renderer';
|
||||
|
||||
import {applyLuxonDefaults} from './effects';
|
||||
|
||||
import RootProvider from './root_provider';
|
||||
@@ -442,7 +440,6 @@ export default class Root extends React.PureComponent<Props, State> {
|
||||
// See figma design on issue https://mattermost.atlassian.net/browse/MM-43649
|
||||
this.props.actions.registerCustomPostRenderer('custom_up_notification', OpenPricingModalPost, 'upgrade_post_message_renderer');
|
||||
this.props.actions.registerCustomPostRenderer('custom_pl_notification', OpenPluginInstallPost, 'plugin_install_post_message_renderer');
|
||||
this.props.actions.registerCustomPostRenderer('system_welcome_post', WelcomePostRenderer, 'welcome_post_renderer');
|
||||
|
||||
if (this.desktopMediaQuery.addEventListener) {
|
||||
this.desktopMediaQuery.addEventListener('change', this.handleMediaQueryChangeEvent);
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
@import 'utils/mixins';
|
||||
|
||||
.WelcomePostRenderer {
|
||||
color: var(--center-channel-color);
|
||||
|
||||
&__ActionsContainer {
|
||||
display: flex;
|
||||
margin-top: 1em;
|
||||
|
||||
& > div {
|
||||
margin-right: 1em;
|
||||
}
|
||||
|
||||
button {
|
||||
@include tertiary-button;
|
||||
@include button-small;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import React from 'react';
|
||||
import {mount} from 'enzyme';
|
||||
|
||||
import {Provider} from 'react-redux';
|
||||
|
||||
import WelcomePostRenderer from 'components/welcome_post_renderer';
|
||||
import {GlobalState} from 'types/store';
|
||||
import {mockStore} from 'tests/test_store';
|
||||
import {Post} from '@mattermost/types/posts';
|
||||
|
||||
describe('components/WelcomePostRenderer', () => {
|
||||
const initialStore = {
|
||||
entities: {
|
||||
channels: {
|
||||
currentChannelId: 'current_channel_id',
|
||||
channels: {
|
||||
current_channel_id: {id: 'current_channel_id'},
|
||||
},
|
||||
},
|
||||
users: {
|
||||
currentUserId: 'user',
|
||||
profiles: {
|
||||
user: {id: 'user', roles: 'system_user'},
|
||||
admin: {id: 'admin', roles: 'system_admin'},
|
||||
},
|
||||
},
|
||||
general: {
|
||||
config: {},
|
||||
},
|
||||
teams: {teams: {current_team_id: {}}, currentTeamId: 'current_team_id'},
|
||||
posts: {posts: {}},
|
||||
groups: {
|
||||
groups: {},
|
||||
myGroups: [],
|
||||
},
|
||||
preferences: {myPreferences: {}},
|
||||
emojis: {},
|
||||
},
|
||||
plugins: {
|
||||
components: {},
|
||||
},
|
||||
|
||||
} as unknown as GlobalState;
|
||||
|
||||
test('should display a help and settings button for users', () => {
|
||||
const store = mockStore({...initialStore});
|
||||
const wrapper = mount(
|
||||
<Provider store={store.store}>
|
||||
<WelcomePostRenderer
|
||||
post={{} as Post}
|
||||
/>
|
||||
</Provider>,
|
||||
store.mountOptions,
|
||||
);
|
||||
|
||||
let found = 0;
|
||||
wrapper.find('button').forEach((button) => {
|
||||
if (button.text() === '/help') {
|
||||
found++;
|
||||
}
|
||||
if (button.text() === '/settings') {
|
||||
found++;
|
||||
}
|
||||
});
|
||||
expect(found).toBe(2);
|
||||
});
|
||||
|
||||
test('should display a help and marketplace button for admin', () => {
|
||||
const store = mockStore({
|
||||
...initialStore,
|
||||
entities: {
|
||||
...initialStore.entities,
|
||||
users: {
|
||||
...initialStore.entities.users,
|
||||
currentUserId: 'admin',
|
||||
},
|
||||
},
|
||||
});
|
||||
const wrapper = mount(
|
||||
<Provider store={store.store}>
|
||||
<WelcomePostRenderer
|
||||
post={{} as Post}
|
||||
/>
|
||||
</Provider>,
|
||||
store.mountOptions,
|
||||
);
|
||||
|
||||
let found = 0;
|
||||
wrapper.find('button').forEach((button) => {
|
||||
if (button.text() === '/help') {
|
||||
found++;
|
||||
}
|
||||
if (button.text() === '/marketplace') {
|
||||
found++;
|
||||
}
|
||||
});
|
||||
expect(found).toBe(2);
|
||||
});
|
||||
});
|
||||
@@ -1,106 +0,0 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import {useIntl} from 'react-intl';
|
||||
|
||||
import {useDispatch, useSelector} from 'react-redux';
|
||||
|
||||
import {Post} from '@mattermost/types/posts';
|
||||
import {submitCommand} from 'actions/views/create_comment';
|
||||
import PostMarkdown from 'components/post_markdown';
|
||||
import {getCurrentChannelId} from 'mattermost-redux/selectors/entities/common';
|
||||
import {isCurrentUserSystemAdmin} from 'mattermost-redux/selectors/entities/users';
|
||||
|
||||
import {PostDraft} from 'types/store/draft';
|
||||
import {localizeMessage} from 'utils/utils';
|
||||
|
||||
import './index.scss';
|
||||
|
||||
export default function WelcomePostRenderer(props: {post: Post}) {
|
||||
const isAdmin = useSelector(isCurrentUserSystemAdmin);
|
||||
const currentChannelId = useSelector(getCurrentChannelId);
|
||||
const {formatMessage} = useIntl();
|
||||
|
||||
const dispatch = useDispatch();
|
||||
|
||||
let message = '';
|
||||
const actions: React.ReactNode[] = [];
|
||||
|
||||
const makeOnClickForCommand = (command: string) => {
|
||||
return () => {
|
||||
const draft: PostDraft = {
|
||||
message: command,
|
||||
uploadsInProgress: [],
|
||||
fileInfos: [],
|
||||
} as unknown as PostDraft;
|
||||
dispatch(submitCommand(currentChannelId, '', draft));
|
||||
};
|
||||
};
|
||||
|
||||
const makeButton = (text: React.ReactNode, command: string) => {
|
||||
return (
|
||||
<button
|
||||
onClick={makeOnClickForCommand(command)}
|
||||
>
|
||||
{text}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
|
||||
const helpButton = makeButton(formatMessage({
|
||||
id: 'welcome_post_renderer.button_label.slash_help',
|
||||
defaultMessage: '/help',
|
||||
}), '/help');
|
||||
|
||||
if (isAdmin) {
|
||||
message = [
|
||||
'### ' + localizeMessage('welcome_post_renderer.admin_message.title', 'Welcome to Mattermost! :rocket:'),
|
||||
'',
|
||||
localizeMessage('welcome_post_renderer.admin_message.first_paragraph', 'Mattermost is an open source platform for secure communication, collaboration, and orchestration of work across tools and teams.'),
|
||||
localizeMessage('welcome_post_renderer.admin_message.second_paragraph', 'Here is a list of commands to use to try and get familiar with the platform.'),
|
||||
].join('\n');
|
||||
|
||||
actions.push(makeButton(formatMessage({
|
||||
id: 'welcome_post_renderer.button_label.slash_marketplace',
|
||||
defaultMessage: '/marketplace',
|
||||
}), '/marketplace'));
|
||||
} else {
|
||||
message = [
|
||||
'### ' + localizeMessage('welcome_post_renderer.user_message.title', 'Welcome to Mattermost! :rocket:'),
|
||||
'',
|
||||
localizeMessage('welcome_post_renderer.user_message.first_paragraph', 'Mattermost is an open source platform for secure communication, collaboration, and orchestration of work across tools and teams.'),
|
||||
localizeMessage('welcome_post_renderer.user_message.second_paragraph', 'Here is a list of commands to use to try and get familiar with the platform.'),
|
||||
].join('\n');
|
||||
|
||||
actions.push(makeButton(formatMessage({
|
||||
id: 'welcome_post_renderer.button_label.slash_settings',
|
||||
defaultMessage: '/settings',
|
||||
}), '/settings'));
|
||||
}
|
||||
actions.push(helpButton);
|
||||
|
||||
return (
|
||||
<div className='WelcomePostRenderer'>
|
||||
<PostMarkdown
|
||||
message={message}
|
||||
isRHS={false}
|
||||
post={props.post}
|
||||
channelId={props.post.channel_id}
|
||||
mentionKeys={[]}
|
||||
/>
|
||||
{actions.length > 0 && (
|
||||
<div className='WelcomePostRenderer__ActionsContainer'>
|
||||
{actions.map((action, idx) => (
|
||||
<div
|
||||
key={'action-' + idx}
|
||||
>
|
||||
{action}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -5681,15 +5681,6 @@
|
||||
"webapp.mattermost.feature.unlimited_file_storage": "Unlimited File Storage",
|
||||
"webapp.mattermost.feature.unlimited_messages": "Unlimited Messages",
|
||||
"webapp.mattermost.feature.upgrade_downgraded_workspace": "Revert the workspace to a paid plan",
|
||||
"welcome_post_renderer.admin_message.first_paragraph": "Mattermost is an open source platform for secure communication, collaboration, and orchestration of work across tools and teams.",
|
||||
"welcome_post_renderer.admin_message.second_paragraph": "Here is a list of commands to use to try and get familiar with the platform.",
|
||||
"welcome_post_renderer.admin_message.title": "Welcome to Mattermost! :rocket:",
|
||||
"welcome_post_renderer.button_label.slash_help": "/help",
|
||||
"welcome_post_renderer.button_label.slash_marketplace": "/marketplace",
|
||||
"welcome_post_renderer.button_label.slash_settings": "/settings",
|
||||
"welcome_post_renderer.user_message.first_paragraph": "Mattermost is an open source platform for secure communication, collaboration, and orchestration of work across tools and teams.",
|
||||
"welcome_post_renderer.user_message.second_paragraph": "Here is a list of commands to use to try and get familiar with the platform.",
|
||||
"welcome_post_renderer.user_message.title": "Welcome to Mattermost! :rocket:",
|
||||
"widget.input.clear": "Clear",
|
||||
"widget.input.required": "This field is required",
|
||||
"widget.passwordInput.createPassword": "Choose a Password",
|
||||
|
||||
Ссылка в новой задаче
Block a user