mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Fixes for admins when LastBoardID doesn't exist (#22993)
* fixes for admins when LastBoardID doesn't exist * lint fixes * Update webapp/boards/src/components/sidebar/sidebarCategory.tsx Co-authored-by: Caleb Roseland <caleb@calebroseland.com> * after deletion, if no boards, send to team (template selector) --------- Co-authored-by: Caleb Roseland <caleb@calebroseland.com> Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
parent
94cb2867a7
commit
a52a6d9abd
@ -25,6 +25,7 @@ import CompassIcon from 'src/widgets/icons/compassIcon'
|
||||
import OptionsIcon from 'src/widgets/icons/options'
|
||||
import Menu from 'src/widgets/menu'
|
||||
import MenuWrapper from 'src/widgets/menuWrapper'
|
||||
import {UserSettings} from 'src/userSettings'
|
||||
|
||||
import './sidebarCategory.scss'
|
||||
import {Category, CategoryBoardMetadata, CategoryBoards} from 'src/store/sidebar'
|
||||
@ -202,12 +203,24 @@ const SidebarCategory = (props: Props) => {
|
||||
setTimeout(() => {
|
||||
showBoard(props.boards[nextBoardId as number].id)
|
||||
}, 120)
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
const newPath = generatePath('/team/:teamId', {teamId: teamID,})
|
||||
history.push(newPath)
|
||||
}, 120)
|
||||
}
|
||||
},
|
||||
async () => {
|
||||
showBoard(deleteBoard.id)
|
||||
},
|
||||
)
|
||||
if (
|
||||
UserSettings.lastBoardId &&
|
||||
UserSettings.lastBoardId[deleteBoard.teamId] == deleteBoard.id
|
||||
) {
|
||||
UserSettings.setLastBoardID(deleteBoard.teamId, null)
|
||||
UserSettings.setLastViewId(deleteBoard.id, null)
|
||||
}
|
||||
}, [showBoard, deleteBoard, props.boards])
|
||||
|
||||
const updateCategory = useCallback(async (value: boolean) => {
|
||||
|
@ -186,7 +186,9 @@ const BoardPage = (props: Props): JSX.Element => {
|
||||
const joinBoard = async (myUser: IUser, boardTeamId: string, boardId: string, allowAdmin: boolean) => {
|
||||
const member = await octoClient.joinBoard(boardId, allowAdmin)
|
||||
if (!member) {
|
||||
if (myUser.permissions?.find((s) => s === 'manage_system' || s === 'manage_team')) {
|
||||
// if allowAdmin is true, then we failed to join the board
|
||||
// as an admin, normally, this is deleted/missing board
|
||||
if (!allowAdmin && myUser.permissions?.find((s) => s === 'manage_system' || s === 'manage_team')) {
|
||||
setShowJoinBoardDialog(true)
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user