* Switch Utils.isMobile to getIsMobileView in most places

* Copy Utils.isMobile into menu widgets

* Actually remove Utils.isMobile

* Remove pointless checkAndSetMobileView action

* Fix incorrect import of UserProfile

* Fix unit test
Этот коммит содержится в:
Harrison Healey
2023-09-01 12:20:45 -04:00
коммит произвёл GitHub
родитель 47e18ea829
Коммит b17daf79b1
30 изменённых файлов: 143 добавлений и 143 удалений

Просмотреть файл

@@ -35,6 +35,11 @@ describe('selectors/onboarding', () => {
profiles,
},
},
views: {
browser: {
windowSize: '',
},
},
} as unknown as GlobalState;
const [showTaskList, firstTimeOnboarding] = getShowTaskListBool(state);
@@ -65,6 +70,11 @@ describe('selectors/onboarding', () => {
profiles,
},
},
views: {
browser: {
windowSize: '',
},
},
} as unknown as GlobalState;
const [showTaskList, firstTimeOnboarding] = getShowTaskListBool(state);
@@ -95,6 +105,11 @@ describe('selectors/onboarding', () => {
profiles,
},
},
views: {
browser: {
windowSize: '',
},
},
} as unknown as GlobalState;
const [showTaskList, firstTimeOnboarding] = getShowTaskListBool(state);
@@ -128,6 +143,11 @@ describe('selectors/onboarding', () => {
profiles,
},
},
views: {
browser: {
windowSize: '',
},
},
} as unknown as GlobalState;
const [showTaskList, firstTimeOnboarding] = getShowTaskListBool(state);
@@ -165,6 +185,11 @@ describe('selectors/onboarding', () => {
profiles,
},
},
views: {
browser: {
windowSize: '',
},
},
} as unknown as GlobalState;
const [showTaskList, firstTimeOnboarding] = getShowTaskListBool(state);

Просмотреть файл

@@ -1,14 +1,14 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {isMobile} from 'utils/utils';
import {createSelector} from 'mattermost-redux/selectors/create_selector';
import {makeGetCategory, getBool} from 'mattermost-redux/selectors/entities/preferences';
import {getCurrentUser, isFirstAdmin} from 'mattermost-redux/selectors/entities/users';
import {OnboardingTaskCategory, OnboardingTaskList} from 'components/onboarding_tasks';
import {getIsMobileView} from 'selectors/views/browser';
import {GlobalState} from 'types/store';
import {RecommendedNextStepsLegacy, Preferences} from 'utils/constants';
@@ -125,9 +125,8 @@ export const getShowTaskListBool = createSelector(
(state: GlobalState) => state,
(state: GlobalState) => getCategory(state, OnboardingTaskCategory),
(state: GlobalState) => getCategory(state, Preferences.RECOMMENDED_NEXT_STEPS),
(state, onboardingPreferences, legacyStepsPreferences) => {
const isMobileView = isMobile();
getIsMobileView,
(state, onboardingPreferences, legacyStepsPreferences, isMobileView) => {
// conditions to validate scenario where users (initially first_admins) had already set any of the onboarding task list preferences values.
// We check wether the preference value exists meaning the onboarding tasks list already started no matter what the state of the process is
const hasUserStartedOnboardingTaskListProcess = onboardingPreferences?.some((pref) =>