Removed draft tour point (#30532)
* Removed draft tour point * Removed unused texts * Fixed e2e tests * Linting --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e495fb3182
Коммит
d69e8b3e90
@@ -422,29 +422,6 @@ function apiSaveUnreadScrollPositionPreference(userId, value) {
|
||||
|
||||
Cypress.Commands.add('apiSaveUnreadScrollPositionPreference', apiSaveUnreadScrollPositionPreference);
|
||||
|
||||
/**
|
||||
* Save drafts tour tip preference.
|
||||
* See https://api.mattermost.com/#tag/preferences/paths/~1users~1{user_id}~1preferences/put
|
||||
* @param {string} userId - User ID
|
||||
* @param {string} value - values are 'true' or 'false'
|
||||
* @returns {Response} response: Cypress-chainable response which should have successful HTTP status of 200 OK to continue or pass.
|
||||
*
|
||||
* @example
|
||||
* cy.apiSaveDraftsTourTipPreference('user-id', 'true');
|
||||
*/
|
||||
function apiSaveDraftsTourTipPreference(userId: string, value: boolean): ChainableT<any> {
|
||||
const preference = {
|
||||
user_id: userId,
|
||||
category: 'drafts',
|
||||
name: 'drafts_tour_tip_showed',
|
||||
value: JSON.stringify({drafts_tour_tip_showed: value}),
|
||||
};
|
||||
|
||||
return cy.apiSaveUserPreference([preference], userId);
|
||||
}
|
||||
|
||||
Cypress.Commands.add('apiSaveDraftsTourTipPreference', apiSaveDraftsTourTipPreference);
|
||||
|
||||
/**
|
||||
* Mark Boards welcome page as viewed.
|
||||
* See https://api.mattermost.com/#tag/preferences/paths/~1users~1{user_id}~1preferences/put
|
||||
@@ -538,12 +515,6 @@ function apiDisableTutorials(userId) {
|
||||
name: userId,
|
||||
value: '999',
|
||||
},
|
||||
{
|
||||
user_id: userId,
|
||||
category: 'drafts',
|
||||
name: 'drafts_tour_tip_showed',
|
||||
value: '{"drafts_tour_tip_showed":true}',
|
||||
},
|
||||
{
|
||||
user_id: userId,
|
||||
category: 'app_bar',
|
||||
@@ -581,7 +552,6 @@ declare global {
|
||||
apiSaveOnboardingTaskListPreference: typeof apiSaveOnboardingTaskListPreference;
|
||||
apiSaveSkipStepsPreference: typeof apiSaveSkipStepsPreference;
|
||||
apiSaveUnreadScrollPositionPreference: typeof apiSaveUnreadScrollPositionPreference;
|
||||
apiSaveDraftsTourTipPreference: typeof apiSaveDraftsTourTipPreference;
|
||||
apiBoardsWelcomePageViewed: typeof apiBoardsWelcomePageViewed;
|
||||
apiSaveJoinLeaveMessagesPreference: typeof apiSaveJoinLeaveMessagesPreference;
|
||||
apiDisableTutorials: typeof apiDisableTutorials;
|
||||
|
||||
@@ -432,9 +432,6 @@ function apiCreateUser({
|
||||
cy.apiSaveOnboardingTaskListPreference(createdUser.id, 'onboarding_task_list_open', 'false');
|
||||
cy.apiSaveOnboardingTaskListPreference(createdUser.id, 'onboarding_task_list_show', 'false');
|
||||
|
||||
// hide drafts tour tip so it doesn't block the execution of subsequent tests
|
||||
cy.apiSaveDraftsTourTipPreference(createdUser.id, true);
|
||||
|
||||
if (bypassTutorial) {
|
||||
cy.apiDisableTutorials(createdUser.id);
|
||||
}
|
||||
|
||||
@@ -266,5 +266,4 @@ function resetUserPreference(userId) {
|
||||
cy.apiSaveSkipStepsPreference(userId, 'true');
|
||||
cy.apiSaveStartTrialModal(userId, 'true');
|
||||
cy.apiSaveUnreadScrollPositionPreference(userId, 'start_from_left_off');
|
||||
cy.apiSaveDraftsTourTipPreference(userId, 'true');
|
||||
}
|
||||
|
||||
@@ -202,12 +202,6 @@ async function savePreferences(client: Client, userId: UserProfile['id']) {
|
||||
|
||||
const preferences: PreferenceType[] = [
|
||||
{user_id: userId, category: 'tutorial_step', name: userId, value: '999'},
|
||||
{
|
||||
user_id: userId,
|
||||
category: 'drafts',
|
||||
name: 'drafts_tour_tip_showed',
|
||||
value: JSON.stringify({drafts_tour_tip_showed: true}),
|
||||
},
|
||||
{user_id: userId, category: 'crt_thread_pane_step', name: userId, value: '999'},
|
||||
];
|
||||
|
||||
|
||||
@@ -52,12 +52,6 @@ export async function initSetup({
|
||||
// Update user preference
|
||||
const preferences: PreferenceType[] = [
|
||||
{user_id: user.id, category: 'tutorial_step', name: user.id, value: '999'},
|
||||
{
|
||||
user_id: user.id,
|
||||
category: 'drafts',
|
||||
name: 'drafts_tour_tip_showed',
|
||||
value: JSON.stringify({drafts_tour_tip_showed: true}),
|
||||
},
|
||||
{user_id: user.id, category: 'crt_thread_pane_step', name: user.id, value: '999'},
|
||||
];
|
||||
await userClient.savePreferences(user.id, preferences);
|
||||
|
||||
@@ -6,12 +6,9 @@ import {batchActions} from 'redux-batched-actions';
|
||||
import type {Draft as ServerDraft} from '@mattermost/types/drafts';
|
||||
import type {FileInfo} from '@mattermost/types/files';
|
||||
import type {PostMetadata, PostPriorityMetadata} from '@mattermost/types/posts';
|
||||
import type {PreferenceType} from '@mattermost/types/preferences';
|
||||
import type {UserProfile} from '@mattermost/types/users';
|
||||
|
||||
import {savePreferences} from 'mattermost-redux/actions/preferences';
|
||||
import {Client4} from 'mattermost-redux/client';
|
||||
import Preferences from 'mattermost-redux/constants/preferences';
|
||||
import {syncedDraftsAreAllowedAndEnabled} from 'mattermost-redux/selectors/entities/preferences';
|
||||
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';
|
||||
|
||||
@@ -137,21 +134,6 @@ function upsertDraft(draft: PostDraft, userId: UserProfile['id'], rootId = '', c
|
||||
return Client4.upsertDraft(newDraft, connectionId);
|
||||
}
|
||||
|
||||
export function setDraftsTourTipPreference(initializationState: Record<string, boolean>): ActionFuncAsync {
|
||||
return async (dispatch, getState) => {
|
||||
const state = getState();
|
||||
const currentUserId = getCurrentUserId(state);
|
||||
const preference: PreferenceType = {
|
||||
user_id: currentUserId,
|
||||
category: Preferences.CATEGORY_DRAFTS,
|
||||
name: Preferences.DRAFTS_TOUR_TIP_SHOWED,
|
||||
value: JSON.stringify(initializationState),
|
||||
};
|
||||
await dispatch(savePreferences(currentUserId, [preference]));
|
||||
return {data: true};
|
||||
};
|
||||
}
|
||||
|
||||
export function setGlobalDraft(key: string, value: PostDraft|null, isRemote: boolean): ActionFunc {
|
||||
return (dispatch) => {
|
||||
dispatch(setGlobalItem(key, value));
|
||||
|
||||
@@ -17,7 +17,6 @@ import {getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
|
||||
import {getDrafts} from 'actions/views/drafts';
|
||||
import {makeGetDraftsCount} from 'selectors/drafts';
|
||||
|
||||
import DraftsTourTip from 'components/drafts/drafts_link/drafts_tour_tip/drafts_tour_tip';
|
||||
import ChannelMentionBadge from 'components/sidebar/sidebar_channel/channel_mention_badge';
|
||||
import WithTooltip from 'components/with_tooltip';
|
||||
|
||||
@@ -161,7 +160,6 @@ function DraftsLink() {
|
||||
</div>
|
||||
</WithTooltip>
|
||||
</NavLink>
|
||||
<DraftsTourTip/>
|
||||
</li>
|
||||
</ul>
|
||||
);
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import React, {memo, useCallback, useState} from 'react';
|
||||
import {FormattedMessage} from 'react-intl';
|
||||
import {useDispatch, useSelector} from 'react-redux';
|
||||
import {useHistory, useRouteMatch} from 'react-router-dom';
|
||||
|
||||
import {TourTip, useMeasurePunchouts} from '@mattermost/components';
|
||||
|
||||
import {Preferences} from 'mattermost-redux/constants';
|
||||
|
||||
import {setDraftsTourTipPreference} from 'actions/views/drafts';
|
||||
import {showDraftsPulsatingDotAndTourTip} from 'selectors/drafts';
|
||||
|
||||
import Tag from 'components/widgets/tag/tag';
|
||||
|
||||
const title = (
|
||||
<span className='d-flex align-items-center'>
|
||||
<FormattedMessage
|
||||
id='drafts.tutorialTip.title'
|
||||
defaultMessage='Drafts'
|
||||
/>
|
||||
<Tag
|
||||
variant='success'
|
||||
text={(
|
||||
<FormattedMessage
|
||||
id='tag.default.new'
|
||||
defaultMessage='NEW'
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</span>
|
||||
);
|
||||
|
||||
const screen = (
|
||||
<>
|
||||
<FormattedMessage
|
||||
id='drafts.tutorialTip.description'
|
||||
defaultMessage='With the new Drafts view, all of your unfinished messages are collected in one place. Return here to read, edit, or send draft messages.'
|
||||
/>
|
||||
</>
|
||||
|
||||
);
|
||||
|
||||
const prevBtn = (
|
||||
<FormattedMessage
|
||||
id='drafts.tutorial_tip.notNow'
|
||||
defaultMessage='Not now'
|
||||
/>
|
||||
);
|
||||
|
||||
const nextBtn = (
|
||||
<FormattedMessage
|
||||
id='drafts.tutorial_tip.viewDrafts'
|
||||
defaultMessage='View drafts'
|
||||
/>
|
||||
);
|
||||
|
||||
const DraftsTourTip = () => {
|
||||
const dispatch = useDispatch();
|
||||
const history = useHistory();
|
||||
|
||||
const showTip = useSelector(showDraftsPulsatingDotAndTourTip);
|
||||
const {url} = useRouteMatch();
|
||||
const nextUrl = `${url}/drafts`;
|
||||
|
||||
const [tipOpened, setTipOpened] = useState(showTip);
|
||||
|
||||
const handleDismiss = useCallback((e: React.MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
dispatch(setDraftsTourTipPreference({[Preferences.DRAFTS_TOUR_TIP_SHOWED]: true}));
|
||||
setTipOpened(false);
|
||||
}, []);
|
||||
|
||||
const handleNext = useCallback(() => {
|
||||
dispatch(setDraftsTourTipPreference({[Preferences.DRAFTS_TOUR_TIP_SHOWED]: true}));
|
||||
setTipOpened(false);
|
||||
history.push(nextUrl);
|
||||
}, []);
|
||||
|
||||
const handleOpen = useCallback((e: React.MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
if (tipOpened) {
|
||||
dispatch(setDraftsTourTipPreference({[Preferences.DRAFTS_TOUR_TIP_SHOWED]: true}));
|
||||
setTipOpened(false);
|
||||
} else {
|
||||
setTipOpened(true);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const overlayPunchOut = useMeasurePunchouts(['sidebar-drafts-button'], []);
|
||||
|
||||
return (
|
||||
<>
|
||||
{
|
||||
(showTip) &&
|
||||
<TourTip
|
||||
show={tipOpened}
|
||||
screen={screen}
|
||||
title={title}
|
||||
overlayPunchOut={overlayPunchOut}
|
||||
placement='right-start'
|
||||
pulsatingDotPlacement='right'
|
||||
step={1}
|
||||
singleTip={true}
|
||||
showOptOut={false}
|
||||
interactivePunchOut={false}
|
||||
handleDismiss={handleDismiss}
|
||||
handleNext={handleNext}
|
||||
handleOpen={handleOpen}
|
||||
handlePrevious={handleDismiss}
|
||||
nextBtn={nextBtn}
|
||||
prevBtn={prevBtn}
|
||||
/>
|
||||
}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default memo(DraftsTourTip);
|
||||
@@ -3675,10 +3675,6 @@
|
||||
"drafts.subtitle": "Any messages you've started will show here",
|
||||
"drafts.title": "{prefix}Drafts - {displayName} {siteName}",
|
||||
"drafts.tooltipText": "{draftCount, plural, =0 {} =1 {1 Draft} other {{draftCount} Drafts}} <br></br> {scheduledPostCount, plural, =0 {} other {{scheduledPostCount} Scheduled}}",
|
||||
"drafts.tutorial_tip.notNow": "Not now",
|
||||
"drafts.tutorial_tip.viewDrafts": "View drafts",
|
||||
"drafts.tutorialTip.description": "With the new Drafts view, all of your unfinished messages are collected in one place. Return here to read, edit, or send draft messages.",
|
||||
"drafts.tutorialTip.title": "Drafts",
|
||||
"edit_category_modal.helpText": "Drag channels into this category to organize your sidebar.",
|
||||
"edit_category_modal.placeholder": "Name your category",
|
||||
"edit_channel_header_modal.cancel": "Cancel",
|
||||
@@ -5346,7 +5342,6 @@
|
||||
"tag.default.beta": "BETA",
|
||||
"tag.default.bot": "BOT",
|
||||
"tag.default.guest": "GUEST",
|
||||
"tag.default.new": "NEW",
|
||||
"team_channel_settings.group.group_user_row.numberOfGroups": "{amount, number} {amount, plural, one {Group} other {Groups}}",
|
||||
"team_groups": "{team} Groups",
|
||||
"team_member_modal.invitePeople": "Invite People",
|
||||
|
||||
@@ -71,7 +71,6 @@ const Preferences = {
|
||||
CATEGORY_ONBOARDING: 'category_onboarding',
|
||||
|
||||
CATEGORY_DRAFTS: 'drafts',
|
||||
DRAFTS_TOUR_TIP_SHOWED: 'drafts_tour_tip_showed',
|
||||
|
||||
CATEGORY_REPORTING: 'reporting',
|
||||
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Preferences} from 'mattermost-redux/constants';
|
||||
import {createSelector} from 'mattermost-redux/selectors/create_selector';
|
||||
import {getMyActiveChannelIds} from 'mattermost-redux/selectors/entities/channels';
|
||||
import {get, onboardingTourTipsEnabled} from 'mattermost-redux/selectors/entities/preferences';
|
||||
|
||||
import {getGlobalItem} from 'selectors/storage';
|
||||
import {getIsMobileView} from 'selectors/views/browser';
|
||||
|
||||
import {StoragePrefixes} from 'utils/constants';
|
||||
import {getDraftInfoFromKey} from 'utils/storage_utils';
|
||||
@@ -24,17 +21,6 @@ export type Draft = DraftInfo & {
|
||||
export type DraftSelector = (state: GlobalState) => Draft[];
|
||||
export type DraftCountSelector = (state: GlobalState) => number;
|
||||
|
||||
export function showDraftsPulsatingDotAndTourTip(state: GlobalState): boolean {
|
||||
if (!onboardingTourTipsEnabled(state) || getIsMobileView(state)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const draftsTourTipShowed = get(state, Preferences.CATEGORY_DRAFTS, Preferences.DRAFTS_TOUR_TIP_SHOWED, '');
|
||||
const draftsAlreadyViewed = draftsTourTipShowed && JSON.parse(draftsTourTipShowed)[Preferences.DRAFTS_TOUR_TIP_SHOWED];
|
||||
|
||||
return !draftsAlreadyViewed;
|
||||
}
|
||||
|
||||
export function makeGetDraftsByPrefix(prefix: string): DraftSelector {
|
||||
return createSelector(
|
||||
'makeGetDraftsByPrefix',
|
||||
|
||||
Ссылка в новой задаче
Block a user