diff --git a/e2e-tests/cypress/tests/support/api/preference.ts b/e2e-tests/cypress/tests/support/api/preference.ts index 8588d4c123..dad9055734 100644 --- a/e2e-tests/cypress/tests/support/api/preference.ts +++ b/e2e-tests/cypress/tests/support/api/preference.ts @@ -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 { - 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; diff --git a/e2e-tests/cypress/tests/support/api/user.ts b/e2e-tests/cypress/tests/support/api/user.ts index 13ecc7f335..abe5c0f41b 100644 --- a/e2e-tests/cypress/tests/support/api/user.ts +++ b/e2e-tests/cypress/tests/support/api/user.ts @@ -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); } diff --git a/e2e-tests/cypress/tests/support/index.js b/e2e-tests/cypress/tests/support/index.js index b93186f9d3..f6b65e7d19 100644 --- a/e2e-tests/cypress/tests/support/index.js +++ b/e2e-tests/cypress/tests/support/index.js @@ -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'); } diff --git a/e2e-tests/playwright/global_setup.ts b/e2e-tests/playwright/global_setup.ts index 3fa9e9f293..25dbf38c53 100644 --- a/e2e-tests/playwright/global_setup.ts +++ b/e2e-tests/playwright/global_setup.ts @@ -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'}, ]; diff --git a/e2e-tests/playwright/support/server/init.ts b/e2e-tests/playwright/support/server/init.ts index f0bd25e3be..7dfced0d57 100644 --- a/e2e-tests/playwright/support/server/init.ts +++ b/e2e-tests/playwright/support/server/init.ts @@ -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); diff --git a/webapp/channels/src/actions/views/drafts.ts b/webapp/channels/src/actions/views/drafts.ts index 0d3de8092a..94013905ea 100644 --- a/webapp/channels/src/actions/views/drafts.ts +++ b/webapp/channels/src/actions/views/drafts.ts @@ -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): 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)); diff --git a/webapp/channels/src/components/drafts/drafts_link/drafts_link.tsx b/webapp/channels/src/components/drafts/drafts_link/drafts_link.tsx index a207abf534..d6713e4eed 100644 --- a/webapp/channels/src/components/drafts/drafts_link/drafts_link.tsx +++ b/webapp/channels/src/components/drafts/drafts_link/drafts_link.tsx @@ -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() { - ); diff --git a/webapp/channels/src/components/drafts/drafts_link/drafts_tour_tip/drafts_tour_tip.tsx b/webapp/channels/src/components/drafts/drafts_link/drafts_tour_tip/drafts_tour_tip.tsx deleted file mode 100644 index 8cb8e5a9fe..0000000000 --- a/webapp/channels/src/components/drafts/drafts_link/drafts_tour_tip/drafts_tour_tip.tsx +++ /dev/null @@ -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 = ( - - - - )} - /> - -); - -const screen = ( - <> - - - -); - -const prevBtn = ( - -); - -const nextBtn = ( - -); - -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) && - - } - - ); -}; - -export default memo(DraftsTourTip); diff --git a/webapp/channels/src/i18n/en.json b/webapp/channels/src/i18n/en.json index 490da24b5a..3de70e740f 100644 --- a/webapp/channels/src/i18n/en.json +++ b/webapp/channels/src/i18n/en.json @@ -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}}

{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", diff --git a/webapp/channels/src/packages/mattermost-redux/src/constants/preferences.ts b/webapp/channels/src/packages/mattermost-redux/src/constants/preferences.ts index 01d391dccf..d8e84353e2 100644 --- a/webapp/channels/src/packages/mattermost-redux/src/constants/preferences.ts +++ b/webapp/channels/src/packages/mattermost-redux/src/constants/preferences.ts @@ -71,7 +71,6 @@ const Preferences = { CATEGORY_ONBOARDING: 'category_onboarding', CATEGORY_DRAFTS: 'drafts', - DRAFTS_TOUR_TIP_SHOWED: 'drafts_tour_tip_showed', CATEGORY_REPORTING: 'reporting', diff --git a/webapp/channels/src/selectors/drafts.ts b/webapp/channels/src/selectors/drafts.ts index 3cc8a7c736..d89292fd3b 100644 --- a/webapp/channels/src/selectors/drafts.ts +++ b/webapp/channels/src/selectors/drafts.ts @@ -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',