mirror of
https://github.com/mattermost/focalboard.git
synced 2025-01-20 18:28:25 +02:00
Dismiss tour config (#2626)
* Added feature flag to disable tour * Fixed tests
This commit is contained in:
parent
4645ecbd11
commit
8ce17a93d0
@ -90,6 +90,11 @@ describe('components/cardDetail/CardDetail', () => {
|
|||||||
},
|
},
|
||||||
current: card.id,
|
current: card.id,
|
||||||
},
|
},
|
||||||
|
clientConfig: {
|
||||||
|
value: {
|
||||||
|
featureFlags: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const component = (
|
const component = (
|
||||||
@ -226,6 +231,11 @@ describe('components/cardDetail/CardDetail', () => {
|
|||||||
},
|
},
|
||||||
current: welcomeCard.id,
|
current: welcomeCard.id,
|
||||||
},
|
},
|
||||||
|
clientConfig: {
|
||||||
|
value: {
|
||||||
|
featureFlags: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const onboardingBoard = TestBlockFactory.createBoard()
|
const onboardingBoard = TestBlockFactory.createBoard()
|
||||||
@ -326,6 +336,11 @@ describe('components/cardDetail/CardDetail', () => {
|
|||||||
},
|
},
|
||||||
current: welcomeCard.id,
|
current: welcomeCard.id,
|
||||||
},
|
},
|
||||||
|
clientConfig: {
|
||||||
|
value: {
|
||||||
|
featureFlags: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const onboardingBoard = TestBlockFactory.createBoard()
|
const onboardingBoard = TestBlockFactory.createBoard()
|
||||||
@ -424,6 +439,11 @@ describe('components/cardDetail/CardDetail', () => {
|
|||||||
},
|
},
|
||||||
current: welcomeCard.id,
|
current: welcomeCard.id,
|
||||||
},
|
},
|
||||||
|
clientConfig: {
|
||||||
|
value: {
|
||||||
|
featureFlags: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
const store = mockStore(state)
|
const store = mockStore(state)
|
||||||
|
|
||||||
|
@ -72,6 +72,11 @@ describe('components/cardDetail/cardDetailContents', () => {
|
|||||||
},
|
},
|
||||||
current: card.id,
|
current: card.id,
|
||||||
},
|
},
|
||||||
|
clientConfig: {
|
||||||
|
value: {
|
||||||
|
featureFlags: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
const store = mockStateStore([], state)
|
const store = mockStateStore([], state)
|
||||||
const wrap = (child: ReactNode): ReactElement => (
|
const wrap = (child: ReactNode): ReactElement => (
|
||||||
|
@ -99,6 +99,11 @@ describe('components/cardDetail/CardDetailProperties', () => {
|
|||||||
},
|
},
|
||||||
current: card.id,
|
current: card.id,
|
||||||
},
|
},
|
||||||
|
clientConfig: {
|
||||||
|
value: {
|
||||||
|
featureFlags: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const mockStore = configureStore([])
|
const mockStore = configureStore([])
|
||||||
|
@ -64,6 +64,11 @@ describe('components/cardDetail/CommentsList', () => {
|
|||||||
},
|
},
|
||||||
current: 'card_id_1',
|
current: 'card_id_1',
|
||||||
},
|
},
|
||||||
|
clientConfig: {
|
||||||
|
value: {
|
||||||
|
featureFlags: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const component = (
|
const component = (
|
||||||
|
@ -38,6 +38,11 @@ describe('components/onboardingTour/addComments/AddCommentTourStep', () => {
|
|||||||
},
|
},
|
||||||
current: 'card_id_1',
|
current: 'card_id_1',
|
||||||
},
|
},
|
||||||
|
clientConfig: {
|
||||||
|
value: {
|
||||||
|
featureFlags: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
let store = mockStore(state)
|
let store = mockStore(state)
|
||||||
|
|
||||||
|
@ -38,6 +38,11 @@ describe('components/onboardingTour/addComments/AddDescriptionTourStep', () => {
|
|||||||
},
|
},
|
||||||
current: 'card_id_1',
|
current: 'card_id_1',
|
||||||
},
|
},
|
||||||
|
clientConfig: {
|
||||||
|
value: {
|
||||||
|
featureFlags: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
let store = mockStore(state)
|
let store = mockStore(state)
|
||||||
|
|
||||||
|
@ -38,6 +38,11 @@ describe('components/onboardingTour/addComments/AddPropertiesTourStep', () => {
|
|||||||
},
|
},
|
||||||
current: 'card_id_1',
|
current: 'card_id_1',
|
||||||
},
|
},
|
||||||
|
clientConfig: {
|
||||||
|
value: {
|
||||||
|
featureFlags: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
let store = mockStore(state)
|
let store = mockStore(state)
|
||||||
|
|
||||||
|
@ -32,6 +32,11 @@ describe('components/onboardingTour/addComments/AddViewTourStep', () => {
|
|||||||
},
|
},
|
||||||
current: 'board_id_1',
|
current: 'board_id_1',
|
||||||
},
|
},
|
||||||
|
clientConfig: {
|
||||||
|
value: {
|
||||||
|
featureFlags: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
let store = mockStore(state)
|
let store = mockStore(state)
|
||||||
|
|
||||||
|
@ -32,6 +32,11 @@ describe('components/onboardingTour/addComments/CopyLinkTourStep', () => {
|
|||||||
},
|
},
|
||||||
current: 'board_id_1',
|
current: 'board_id_1',
|
||||||
},
|
},
|
||||||
|
clientConfig: {
|
||||||
|
value: {
|
||||||
|
featureFlags: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
let store = mockStore(state)
|
let store = mockStore(state)
|
||||||
|
|
||||||
|
@ -38,6 +38,11 @@ describe('components/onboardingTour/addComments/OpenCardTourStep', () => {
|
|||||||
},
|
},
|
||||||
current: 'card_id_1',
|
current: 'card_id_1',
|
||||||
},
|
},
|
||||||
|
clientConfig: {
|
||||||
|
value: {
|
||||||
|
featureFlags: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
let store = mockStore(state)
|
let store = mockStore(state)
|
||||||
|
|
||||||
|
@ -38,6 +38,11 @@ describe('components/onboardingTour/addComments/ShareBoardTourStep', () => {
|
|||||||
},
|
},
|
||||||
current: 'card_id_1',
|
current: 'card_id_1',
|
||||||
},
|
},
|
||||||
|
clientConfig: {
|
||||||
|
value: {
|
||||||
|
featureFlags: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
let store = mockStore(state)
|
let store = mockStore(state)
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@ import {OnboardingBoardTitle, OnboardingCardTitle} from '../../cardDetail/cardDe
|
|||||||
import {getOnboardingTourCategory, getOnboardingTourStarted, getOnboardingTourStep} from '../../../store/users'
|
import {getOnboardingTourCategory, getOnboardingTourStarted, getOnboardingTourStep} from '../../../store/users'
|
||||||
import TourTip from '../../tutorial_tour_tip/tutorial_tour_tip'
|
import TourTip from '../../tutorial_tour_tip/tutorial_tour_tip'
|
||||||
import {TutorialTourTipPunchout} from '../../tutorial_tour_tip/tutorial_tour_tip_backdrop'
|
import {TutorialTourTipPunchout} from '../../tutorial_tour_tip/tutorial_tour_tip_backdrop'
|
||||||
|
import {ClientConfig} from '../../../config/clientConfig'
|
||||||
|
import {getClientConfig} from '../../../store/clientConfig'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
requireCard: boolean
|
requireCard: boolean
|
||||||
@ -30,12 +32,13 @@ type Props = {
|
|||||||
|
|
||||||
const TourTipRenderer = (props: Props): JSX.Element | null => {
|
const TourTipRenderer = (props: Props): JSX.Element | null => {
|
||||||
const board = useAppSelector(getCurrentBoard)
|
const board = useAppSelector(getCurrentBoard)
|
||||||
|
const clientConfig = useAppSelector<ClientConfig>(getClientConfig)
|
||||||
|
|
||||||
const isOnboardingBoard = board ? board.title === OnboardingBoardTitle : false
|
const isOnboardingBoard = board ? board.title === OnboardingBoardTitle : false
|
||||||
const onboardingTourStarted = useAppSelector(getOnboardingTourStarted)
|
const onboardingTourStarted = useAppSelector(getOnboardingTourStarted)
|
||||||
const onboardingTourCategory = useAppSelector(getOnboardingTourCategory)
|
const onboardingTourCategory = useAppSelector(getOnboardingTourCategory)
|
||||||
const onboardingTourStep = useAppSelector(getOnboardingTourStep)
|
const onboardingTourStep = useAppSelector(getOnboardingTourStep)
|
||||||
const showTour = isOnboardingBoard && onboardingTourStarted && onboardingTourCategory === props.category
|
const showTour = !clientConfig.featureFlags.disableTour && isOnboardingBoard && onboardingTourStarted && onboardingTourCategory === props.category
|
||||||
let showTourTip = showTour && onboardingTourStep === props.step.toString()
|
let showTourTip = showTour && onboardingTourStep === props.step.toString()
|
||||||
|
|
||||||
if (props.requireCard) {
|
if (props.requireCard) {
|
||||||
|
@ -12,6 +12,8 @@ import {getLoggedIn, getMe} from './store/users'
|
|||||||
import {useAppSelector} from './store/hooks'
|
import {useAppSelector} from './store/hooks'
|
||||||
import {UserSettingKey} from './userSettings'
|
import {UserSettingKey} from './userSettings'
|
||||||
import {IUser, UserPropPrefix} from './user'
|
import {IUser, UserPropPrefix} from './user'
|
||||||
|
import {getClientConfig} from './store/clientConfig'
|
||||||
|
import {ClientConfig} from './config/clientConfig'
|
||||||
|
|
||||||
type RouteProps = {
|
type RouteProps = {
|
||||||
path: string|string[]
|
path: string|string[]
|
||||||
@ -27,13 +29,21 @@ function FBRoute(props: RouteProps) {
|
|||||||
const loggedIn = useAppSelector<boolean|null>(getLoggedIn)
|
const loggedIn = useAppSelector<boolean|null>(getLoggedIn)
|
||||||
const match = useRouteMatch<any>()
|
const match = useRouteMatch<any>()
|
||||||
const me = useAppSelector<IUser|null>(getMe)
|
const me = useAppSelector<IUser|null>(getMe)
|
||||||
|
const clientConfig = useAppSelector<ClientConfig>(getClientConfig)
|
||||||
|
|
||||||
let originalPath
|
let originalPath
|
||||||
if (props.getOriginalPath) {
|
if (props.getOriginalPath) {
|
||||||
originalPath = props.getOriginalPath(match)
|
originalPath = props.getOriginalPath(match)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils.isFocalboardPlugin() && (me?.id !== 'single-user') && props.path !== '/welcome' && loggedIn === true && !me?.props[UserPropPrefix + UserSettingKey.WelcomePageViewed]) {
|
const showWelcomePage = !clientConfig.featureFlags.disableTour &&
|
||||||
|
Utils.isFocalboardPlugin() &&
|
||||||
|
(me?.id !== 'single-user') &&
|
||||||
|
props.path !== '/welcome' &&
|
||||||
|
loggedIn === true &&
|
||||||
|
!me?.props[UserPropPrefix + UserSettingKey.WelcomePageViewed]
|
||||||
|
|
||||||
|
if (showWelcomePage) {
|
||||||
if (originalPath) {
|
if (originalPath) {
|
||||||
return <Redirect to={`/welcome?r=${originalPath}`}/>
|
return <Redirect to={`/welcome?r=${originalPath}`}/>
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user