mirror of
https://github.com/mattermost/focalboard.git
synced 2025-01-23 18:34:02 +02:00
Fixed incorrect navigation bug (#3004)
This commit is contained in:
parent
b2ec507e8f
commit
aec7c9de10
2
mattermost-plugin/server/manifest.go
generated
2
mattermost-plugin/server/manifest.go
generated
@ -21,7 +21,7 @@ const manifestStr = `
|
||||
"release_notes_url": "https://github.com/mattermost/focalboard/releases",
|
||||
"icon_path": "assets/starter-template-icon.svg",
|
||||
"version": "0.17.0",
|
||||
"min_server_version": "6.7.0",
|
||||
"min_server_version": "6.0.0",
|
||||
"server": {
|
||||
"executables": {
|
||||
"darwin-amd64": "server/dist/plugin-darwin-amd64",
|
||||
|
@ -3,7 +3,7 @@
|
||||
import {useEffect} from 'react'
|
||||
import {generatePath, useHistory, useRouteMatch} from 'react-router-dom'
|
||||
|
||||
import {getCurrentBoardId} from '../../store/boards'
|
||||
import {getBoards, getCurrentBoardId} from '../../store/boards'
|
||||
import {setCurrent as setCurrentView, getCurrentBoardViews} from '../../store/views'
|
||||
import {useAppSelector, useAppDispatch} from '../../store/hooks'
|
||||
import {UserSettings} from '../../userSettings'
|
||||
@ -17,23 +17,34 @@ const TeamToBoardAndViewRedirect = (): null => {
|
||||
const history = useHistory()
|
||||
const match = useRouteMatch<{boardId: string, viewId: string, cardId?: string, teamId?: string}>()
|
||||
const categories = useAppSelector(getSidebarCategories)
|
||||
const boards = useAppSelector(getBoards)
|
||||
const teamId = match.params.teamId || UserSettings.lastTeamId || Constants.globalTeamId
|
||||
|
||||
useEffect(() => {
|
||||
let boardID = match.params.boardId
|
||||
if (!match.params.boardId) {
|
||||
// first preference is for last visited board
|
||||
boardID = UserSettings.lastBoardId[teamId]
|
||||
if (boards[UserSettings.lastBoardId[teamId]]) {
|
||||
boardID = UserSettings.lastBoardId[teamId]
|
||||
}
|
||||
|
||||
// if last visited board is unavailable, use the first board in categories list
|
||||
if (!boardID && categories.length > 0) {
|
||||
// a category may exist without any boards.
|
||||
// find the first category with a board and pick it's first board
|
||||
const categoryWithBoards = categories.find((category) => category.boardIDs.length > 0)
|
||||
let goToBoardID: string | null = null
|
||||
|
||||
for (const category of categories) {
|
||||
for (const categoryBoardID of category.boardIDs) {
|
||||
if (boards[categoryBoardID]) {
|
||||
// pick the first category board that exists
|
||||
goToBoardID = categoryBoardID
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// there may even be no boards at all
|
||||
if (categoryWithBoards) {
|
||||
boardID = categoryWithBoards.boardIDs[0]
|
||||
if (goToBoardID) {
|
||||
boardID = goToBoardID
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user