Skip to content

Commit

Permalink
chore: fix sonarcloud issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cmeessen committed Oct 2, 2024
1 parent fddc594 commit 19cc951
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion frontend/components/layout/UserMenu.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: 2022 Dusan Mijatovic (dv4all)
// SPDX-FileCopyrightText: 2022 dv4all
// SPDX-FileCopyrightText: 2024 Christian Meeßen (GFZ) <[email protected]>
// SPDX-FileCopyrightText: 2024 Dusan Mijatovic (Netherlands eScience Center)
// SPDX-FileCopyrightText: 2024 Helmholtz Centre Potsdam - GFZ German Research Centre for Geosciences
// SPDX-FileCopyrightText: 2024 Netherlands eScience Center
//
// SPDX-License-Identifier: Apache-2.0
Expand All @@ -9,7 +11,6 @@ import {render,screen, fireEvent} from '@testing-library/react'
import {WithAppContext, mockSession} from '~/utils/jest/WithAppContext'

import UserMenu from './UserMenu'
import {userMenuItems} from '~/config/menuItems'

it('should render userMenu', () => {
render (
Expand Down
5 changes: 3 additions & 2 deletions frontend/config/RsdPluginContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//
// SPDX-License-Identifier: Apache-2.0

import {createContext, useContext, useEffect, useState} from 'react'
import {createContext, useContext, useEffect, useMemo, useState} from 'react'

// Defines the possible names for plugin slots, referred by the individual components
export type PluginSlot = 'userMenu'|'editSoftwareNav'
Expand All @@ -27,9 +27,10 @@ export const RsdPluginContext = createContext<{settings:PluginConfig[]}>({settin

export default function PluginSettingsProvider(props: any) {
const [settings, setSettings] = useState(props?.settings ?? [])
const value = useMemo(() => ({settings, setSettings}), [settings, setSettings])

return <RsdPluginContext.Provider
value={{settings,setSettings}}
value={value}
{...props}
/>
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/config/useUserMenuItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function useUserMenuItems(){
const items: MenuItemType[] = []

userMenuItems.forEach( (item) => {
if (item.active && item.active({role: user?.role, modules: host.modules})){
if (item.active?.({role: user?.role, modules: host.modules})){
items.push(item)
} else if (item.type == 'pluginSlot') {
// add plugins to user menu
Expand Down

0 comments on commit 19cc951

Please sign in to comment.