diff --git a/webapp/src/components/topBar.tsx b/webapp/src/components/topBar.tsx
index 97b4f4e56ad..37d299fa8cc 100644
--- a/webapp/src/components/topBar.tsx
+++ b/webapp/src/components/topBar.tsx
@@ -7,39 +7,9 @@ import './topBar.scss'
import {FormattedMessage} from 'react-intl'
import HelpIcon from '../widgets/icons/help'
-import {Utils} from '../utils'
import {Constants} from '../constants'
const TopBar = (): JSX.Element => {
- if (Utils.isFocalboardPlugin()) {
- const feedbackUrl = 'https://www.focalboard.com/fwlink/feedback-boards.html?v=' + Constants.versionString
- return (
-
-
-
-
-
-
- {`v${Constants.versionString}`}
-
-
-
- )
- }
-
const focalboardFeedbackUrl = 'https://www.focalboard.com/fwlink/feedback-focalboard.html?v=' + Constants.versionString
return (
{
return
}
- if (!Utils.isFocalboardPlugin()) {
- const token = localStorage.getItem('focalboardSessionId') || queryString.get('r') || ''
- if (token) {
- wsClient.authenticate(token)
- }
- wsClient.open()
- return
- }
-
- if (!props.webSocketClient) {
- Utils.logWarn('Trying to initialise Boards websocket in plugin mode without base connection. Aborting')
- return
- }
-
- if (!props.manifest?.id || !props.manifest?.version) {
- Utils.logError('Trying to initialise Boards websocket in plugin mode with an incomplete manifest. Aborting')
- return
+ const token = localStorage.getItem('focalboardSessionId') || queryString.get('r') || ''
+ if (token) {
+ wsClient.authenticate(token)
}
-
- wsClient.initPlugin(props.manifest?.id, props.manifest?.version, props.webSocketClient)
wsClient.open()
}, [props.webSocketClient])
useEffect(() => {
// if we're running on a plugin instance or we don't have a
// user yet, do nothing
- if (Utils.isFocalboardPlugin() || !props.userId) {
+ if (!props.userId) {
return
}
diff --git a/webapp/src/pages/boardPage/boardPage.tsx b/webapp/src/pages/boardPage/boardPage.tsx
index a2b4e953b76..72fcaca2201 100644
--- a/webapp/src/pages/boardPage/boardPage.tsx
+++ b/webapp/src/pages/boardPage/boardPage.tsx
@@ -37,7 +37,6 @@ import {updateComments} from '../../store/comments'
import {updateAttachments} from '../../store/attachments'
import {updateContents} from '../../store/contents'
import {
- fetchUserBlockSubscriptions,
getMe,
followBlock,
unfollowBlock,
@@ -88,17 +87,6 @@ const BoardPage = (props: Props): JSX.Element => {
window.location.href = window.location.href.replace('/plugins/focalboard', '/boards')
}
- // Load user's block subscriptions when workspace changes
- // block subscriptions are relevant only in plugin mode.
- if (Utils.isFocalboardPlugin()) {
- useEffect(() => {
- if (!me) {
- return
- }
- dispatch(fetchUserBlockSubscriptions(me!.id))
- }, [me?.id])
- }
-
// TODO: Make this less brittle. This only works because this is the root render function
useEffect(() => {
UserSettings.lastTeamId = teamId
diff --git a/webapp/src/pages/boardPage/setWindowTitleAndIcon.tsx b/webapp/src/pages/boardPage/setWindowTitleAndIcon.tsx
index 2253714302a..fbada1471d5 100644
--- a/webapp/src/pages/boardPage/setWindowTitleAndIcon.tsx
+++ b/webapp/src/pages/boardPage/setWindowTitleAndIcon.tsx
@@ -22,8 +22,6 @@ const SetWindowTitleAndIcon = (): null => {
title += ` | ${activeView.title}`
}
document.title = title
- } else if (Utils.isFocalboardPlugin()) {
- document.title = 'Boards - Mattermost'
} else {
document.title = 'Focalboard'
}
diff --git a/webapp/src/pages/errorPage.tsx b/webapp/src/pages/errorPage.tsx
index 37504544b47..d8d6c472c8e 100644
--- a/webapp/src/pages/errorPage.tsx
+++ b/webapp/src/pages/errorPage.tsx
@@ -10,7 +10,6 @@ import Button from '../widgets/buttons/button'
import './errorPage.scss'
import {errorDefFromId, ErrorId} from '../errors'
-import {Utils} from '../utils'
const ErrorPage = () => {
const history = useHistory()
@@ -46,7 +45,7 @@ const ErrorPage = () => {
)
})
- if (!Utils.isFocalboardPlugin() && errid === ErrorId.NotLoggedIn) {
+ if (errid === ErrorId.NotLoggedIn) {
handleButtonClick(errorDef.button1Redirect)
}
diff --git a/webapp/src/route.tsx b/webapp/src/route.tsx
index 46063b700ef..e6d6cbc73e9 100644
--- a/webapp/src/route.tsx
+++ b/webapp/src/route.tsx
@@ -7,12 +7,8 @@ import {
} from 'react-router-dom'
import {Utils} from './utils'
-import {getLoggedIn, getMe, getMyConfig} from './store/users'
+import {getLoggedIn} from './store/users'
import {useAppSelector} from './store/hooks'
-import {UserSettingKey} from './userSettings'
-import {IUser} from './user'
-import {getClientConfig} from './store/clientConfig'
-import {ClientConfig} from './config/clientConfig'
type RouteProps = {
path: string|string[]
@@ -26,31 +22,8 @@ type RouteProps = {
function FBRoute(props: RouteProps) {
const loggedIn = useAppSelector(getLoggedIn)
- const me = useAppSelector(getMe)
- const myConfig = useAppSelector(getMyConfig)
- const clientConfig = useAppSelector(getClientConfig)
-
let redirect: React.ReactNode = null
- // No FTUE for guests
- const disableTour = me?.is_guest || clientConfig?.featureFlags?.disableTour || false
-
- const showWelcomePage = !disableTour &&
- Utils.isFocalboardPlugin() &&
- (me?.id !== 'single-user') &&
- props.path !== '/welcome' &&
- loggedIn === true &&
- !myConfig[UserSettingKey.WelcomePageViewed]
-
- if (showWelcomePage) {
- redirect = ({match}: any) => {
- if (props.getOriginalPath) {
- return
- }
- return
- }
- }
-
if (redirect === null && loggedIn === false && props.loginRequired) {
redirect = ({match}: any) => {
if (props.getOriginalPath) {
diff --git a/webapp/src/router.tsx b/webapp/src/router.tsx
index 01b67f1ee7e..2421a8f4d71 100644
--- a/webapp/src/router.tsx
+++ b/webapp/src/router.tsx
@@ -3,7 +3,6 @@
import React, {useEffect, useMemo} from 'react'
import {
Router,
- Redirect,
Switch,
useRouteMatch,
useHistory,
@@ -12,10 +11,8 @@ import {
} from 'react-router-dom'
import {createBrowserHistory, History} from 'history'
-import {IAppWindow} from './types'
import BoardPage from './pages/boardPage/boardPage'
import ChangePasswordPage from './pages/changePasswordPage'
-import WelcomePage from './pages/welcome/welcomePage'
import ErrorPage from './pages/errorPage'
import LoginPage from './pages/loginPage'
import RegisterPage from './pages/registerPage'
@@ -23,52 +20,10 @@ import {Utils} from './utils'
import octoClient from './octoClient'
import {setGlobalError, getGlobalError} from './store/globalError'
import {useAppSelector, useAppDispatch} from './store/hooks'
-import {getFirstTeam, fetchTeams, Team} from './store/teams'
-import {UserSettings} from './userSettings'
import FBRoute from './route'
-declare let window: IAppWindow
-
const UUID_REGEX = new RegExp(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/)
-function HomeToCurrentTeam(props: {path: string, exact: boolean}) {
- return (
- {
- const firstTeam = useAppSelector(getFirstTeam)
- const dispatch = useAppDispatch()
- useEffect(() => {
- dispatch(fetchTeams())
- }, [])
-
- let teamID = (window.getCurrentTeamId && window.getCurrentTeamId()) || ''
- const lastTeamID = UserSettings.lastTeamId
- if (!teamID && !firstTeam && !lastTeamID) {
- return <>>
- }
- teamID = teamID || lastTeamID || firstTeam?.id || ''
-
- if (UserSettings.lastBoardId) {
- const lastBoardID = UserSettings.lastBoardId[teamID]
- const lastViewID = UserSettings.lastViewId[lastBoardID]
-
- if (lastBoardID && lastViewID) {
- return
- }
- if (lastBoardID) {
- return
- }
- }
-
- return
- }}
- />
- )
-}
-
function WorkspaceToTeamRedirect() {
const match = useRouteMatch<{boardId: string, viewId: string, cardId?: string, workspaceId?: string}>()
const queryParams = new URLSearchParams(useLocation().search)
@@ -112,8 +67,6 @@ type Props = {
}
const FocalboardRouter = (props: Props): JSX.Element => {
- const isPlugin = Utils.isFocalboardPlugin()
-
let browserHistory: History
if (props.history) {
browserHistory = props.history
@@ -123,47 +76,23 @@ const FocalboardRouter = (props: Props): JSX.Element => {
}, [])
}
- if (isPlugin) {
- useEffect(() => {
- if (window.frontendBaseURL) {
- browserHistory.replace(window.location.pathname.replace(window.frontendBaseURL, ''))
- }
- }, [])
- }
-
return (
- {isPlugin &&
- }
- {isPlugin &&
-
-
- }
-
- {!isPlugin &&
-
-
- }
- {!isPlugin &&
-
-
- }
- {!isPlugin &&
-
-
- }
+
+
+
+
+
+
+
+
+
@@ -195,20 +124,19 @@ const FocalboardRouter = (props: Props): JSX.Element => {
- {!isPlugin &&
- {
- const boardIdIsValidUUIDV4 = UUID_REGEX.test(boardId || '')
- if (boardIdIsValidUUIDV4) {
- return `/${Utils.buildOriginalPath('', boardId, viewId, cardId)}`
- }
- return ''
- }}
- >
-
- }
+ {
+ const boardIdIsValidUUIDV4 = UUID_REGEX.test(boardId || '')
+ if (boardIdIsValidUUIDV4) {
+ return `/${Utils.buildOriginalPath('', boardId, viewId, cardId)}`
+ }
+ return ''
+ }}
+ >
+
+
)
diff --git a/webapp/src/store/users.ts b/webapp/src/store/users.ts
index cb5a71a0a13..6446c6ae63a 100644
--- a/webapp/src/store/users.ts
+++ b/webapp/src/store/users.ts
@@ -6,8 +6,6 @@ import {createSlice, createAsyncThunk, PayloadAction, createSelector} from '@red
import {default as client} from '../octoClient'
import {IUser, parseUserProps, UserPreference} from '../user'
-import {Utils} from '../utils'
-
import {Subscription} from '../wsclient'
import {initialLoad} from './initialLoad'
@@ -37,7 +35,7 @@ type UsersStatus = {
export const fetchUserBlockSubscriptions = createAsyncThunk(
'user/blockSubscriptions',
- async (userId: string) => (Utils.isFocalboardPlugin() ? client.getUserBlockSubscriptions(userId) : []),
+ async () => ([]),
)
const initialState = {
diff --git a/webapp/src/theme.ts b/webapp/src/theme.ts
index f4616098186..160931d9db3 100644
--- a/webapp/src/theme.ts
+++ b/webapp/src/theme.ts
@@ -5,8 +5,6 @@ import {CSSObject} from '@emotion/serialize'
import isEqual from 'lodash/isEqual'
import color from 'color'
-import {Utils} from './utils'
-
let activeThemeName: string
import {UserSettings} from './userSettings'
@@ -124,67 +122,20 @@ export function setTheme(theme: Theme | null): Theme {
setActiveThemeName(consolidatedTheme, theme)
- if (Utils.isFocalboardPlugin()) {
- // in plugin mode, Focalbaord reuses Mattermost's color pallet, so we don't really need to
- // set the color variables here because in the app, Mattermost webapp would have already
- // declared them.
- // But,
- // when testing the plugin mode in Jest unit test,
- // since there is no Mattermost webapp, we need to ensure someone declares the variables.
- // So here we set the variable if it wasn't already declared.
- // In plugins, since Mattermost webapp renders always before the plugin/product,
- // the variables are guaranteed to be set there.
- //
- // Fun fact - in a Jest test suite, if there are some non-plugin tests and a few plugin tests,
- // if a non-plugin test ran first, it creates the variables in document, which is somehow
- // shared to other tests as well. That's why the tests don't fail unless you run ONLY
- // a plugin test.
-
- const style = document.documentElement.style
-
- style.setProperty('--center-channel-bg-rgb', style.getPropertyValue('--center-channel-bg-rgb') || consolidatedTheme.mainBg)
- style.setProperty('--center-channel-color-rgb', style.getPropertyValue('--center-channel-color-rgb') || consolidatedTheme.mainBg)
- style.setProperty('--button-bg-rgb', style.getPropertyValue('--button-bg-rgb') || consolidatedTheme.mainBg)
- style.setProperty('--button-color-rgb', style.getPropertyValue('--button-color-rgb') || consolidatedTheme.mainBg)
- style.setProperty('--sidebar-bg-rgb', style.getPropertyValue('--sidebar-bg-rgb') || consolidatedTheme.mainBg)
- style.setProperty('--sidebar-text-rgb', style.getPropertyValue('--sidebar-text-rgb') || consolidatedTheme.mainBg)
- style.setProperty('--link-color-rgb', style.getPropertyValue('--link-color-rgb') || consolidatedTheme.mainBg)
- style.setProperty('--sidebar-text-active-border-rgb', style.getPropertyValue('--sidebar-text-active-border-rgb') || consolidatedTheme.mainBg)
- } else {
- // for personal server and desktop, Focalboard is responsible for managing the theme,
- // so we set all the color variables here.
- document.documentElement.style.setProperty('--center-channel-bg-rgb', consolidatedTheme.mainBg)
- document.documentElement.style.setProperty('--center-channel-color-rgb', consolidatedTheme.mainFg)
- document.documentElement.style.setProperty('--button-bg-rgb', consolidatedTheme.buttonBg)
- document.documentElement.style.setProperty('--button-color-rgb', consolidatedTheme.buttonFg)
- document.documentElement.style.setProperty('--sidebar-bg-rgb', consolidatedTheme.sidebarBg)
- document.documentElement.style.setProperty('--sidebar-text-rgb', consolidatedTheme.sidebarFg)
- document.documentElement.style.setProperty('--link-color-rgb', consolidatedTheme.link)
- document.documentElement.style.setProperty('--sidebar-text-active-border-rgb', consolidatedTheme.sidebarTextActiveBorder)
- }
+ // for personal server and desktop, Focalboard is responsible for managing the theme,
+ // so we set all the color variables here.
+ document.documentElement.style.setProperty('--center-channel-bg-rgb', consolidatedTheme.mainBg)
+ document.documentElement.style.setProperty('--center-channel-color-rgb', consolidatedTheme.mainFg)
+ document.documentElement.style.setProperty('--button-bg-rgb', consolidatedTheme.buttonBg)
+ document.documentElement.style.setProperty('--button-color-rgb', consolidatedTheme.buttonFg)
+ document.documentElement.style.setProperty('--sidebar-bg-rgb', consolidatedTheme.sidebarBg)
+ document.documentElement.style.setProperty('--sidebar-text-rgb', consolidatedTheme.sidebarFg)
+ document.documentElement.style.setProperty('--link-color-rgb', consolidatedTheme.link)
+ document.documentElement.style.setProperty('--sidebar-text-active-border-rgb', consolidatedTheme.sidebarTextActiveBorder)
document.documentElement.style.setProperty('--sidebar-white-logo', consolidatedTheme.sidebarWhiteLogo)
document.documentElement.style.setProperty('--link-visited-color-rgb', consolidatedTheme.linkVisited)
- const mainBgColor = color(`rgb(${getComputedStyle(document.documentElement).getPropertyValue('--center-channel-bg-rgb')})`)
-
- if (Utils.isFocalboardPlugin()) {
- let fixedTheme = lightTheme
- if (mainBgColor.isDark()) {
- fixedTheme = darkTheme
- }
- consolidatedTheme.propDefault = fixedTheme.propDefault
- consolidatedTheme.propGray = fixedTheme.propGray
- consolidatedTheme.propBrown = fixedTheme.propBrown
- consolidatedTheme.propOrange = fixedTheme.propOrange
- consolidatedTheme.propYellow = fixedTheme.propYellow
- consolidatedTheme.propGreen = fixedTheme.propGreen
- consolidatedTheme.propBlue = fixedTheme.propBlue
- consolidatedTheme.propPurple = fixedTheme.propPurple
- consolidatedTheme.propPink = fixedTheme.propPink
- consolidatedTheme.propRed = fixedTheme.propRed
- }
-
document.documentElement.style.setProperty('--prop-default', consolidatedTheme.propDefault)
document.documentElement.style.setProperty('--prop-gray', consolidatedTheme.propGray)
document.documentElement.style.setProperty('--prop-brown', consolidatedTheme.propBrown)
diff --git a/webapp/src/utils.ts b/webapp/src/utils.ts
index 3a2954d180f..d3779911128 100644
--- a/webapp/src/utils.ts
+++ b/webapp/src/utils.ts
@@ -424,11 +424,6 @@ class Utils {
// favicon
static setFavicon(icon?: string): void {
- if (Utils.isFocalboardPlugin()) {
- // Do not change the icon from focalboard plugin
- return
- }
-
if (!icon) {
document.querySelector("link[rel*='icon']")?.remove()
return
@@ -583,11 +578,6 @@ class Utils {
}
static buildURL(path: string, absolute?: boolean): string {
- /* eslint-disable no-process-env */
- if (!Utils.isFocalboardPlugin() || process.env.TARGET_IS_PRODUCT) {
- return path
- }
-
const baseURL = Utils.getBaseURL()
let finalPath = baseURL + path
if (path.indexOf('/') !== 0) {
@@ -606,10 +596,6 @@ class Utils {
return Math.round(num * Math.pow(10, decimalPlaces)) / Math.pow(10, decimalPlaces)
}
- static isFocalboardPlugin(): boolean {
- return Boolean(window.isFocalboardPlugin)
- }
-
// this is a temporary solution while we're using legacy routes
// for shared boards as a way to check if we're accessing the
// legacy routes inside the plugin