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",
|
"release_notes_url": "https://github.com/mattermost/focalboard/releases",
|
||||||
"icon_path": "assets/starter-template-icon.svg",
|
"icon_path": "assets/starter-template-icon.svg",
|
||||||
"version": "0.17.0",
|
"version": "0.17.0",
|
||||||
"min_server_version": "6.7.0",
|
"min_server_version": "6.0.0",
|
||||||
"server": {
|
"server": {
|
||||||
"executables": {
|
"executables": {
|
||||||
"darwin-amd64": "server/dist/plugin-darwin-amd64",
|
"darwin-amd64": "server/dist/plugin-darwin-amd64",
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
import {useEffect} from 'react'
|
import {useEffect} from 'react'
|
||||||
import {generatePath, useHistory, useRouteMatch} from 'react-router-dom'
|
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 {setCurrent as setCurrentView, getCurrentBoardViews} from '../../store/views'
|
||||||
import {useAppSelector, useAppDispatch} from '../../store/hooks'
|
import {useAppSelector, useAppDispatch} from '../../store/hooks'
|
||||||
import {UserSettings} from '../../userSettings'
|
import {UserSettings} from '../../userSettings'
|
||||||
@ -17,23 +17,34 @@ const TeamToBoardAndViewRedirect = (): null => {
|
|||||||
const history = useHistory()
|
const history = useHistory()
|
||||||
const match = useRouteMatch<{boardId: string, viewId: string, cardId?: string, teamId?: string}>()
|
const match = useRouteMatch<{boardId: string, viewId: string, cardId?: string, teamId?: string}>()
|
||||||
const categories = useAppSelector(getSidebarCategories)
|
const categories = useAppSelector(getSidebarCategories)
|
||||||
|
const boards = useAppSelector(getBoards)
|
||||||
const teamId = match.params.teamId || UserSettings.lastTeamId || Constants.globalTeamId
|
const teamId = match.params.teamId || UserSettings.lastTeamId || Constants.globalTeamId
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let boardID = match.params.boardId
|
let boardID = match.params.boardId
|
||||||
if (!match.params.boardId) {
|
if (!match.params.boardId) {
|
||||||
// first preference is for last visited board
|
// 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 last visited board is unavailable, use the first board in categories list
|
||||||
if (!boardID && categories.length > 0) {
|
if (!boardID && categories.length > 0) {
|
||||||
// a category may exist without any boards.
|
let goToBoardID: string | null = null
|
||||||
// find the first category with a board and pick it's first board
|
|
||||||
const categoryWithBoards = categories.find((category) => category.boardIDs.length > 0)
|
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
|
// there may even be no boards at all
|
||||||
if (categoryWithBoards) {
|
if (goToBoardID) {
|
||||||
boardID = categoryWithBoards.boardIDs[0]
|
boardID = goToBoardID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user