Skip to content

Commit

Permalink
Various improvements to check if user isViewAuthor
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi749 committed Nov 5, 2024
1 parent 6e59f48 commit 83f7896
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import { MenuProps, useId } from '@fluentui/react-components'
export function useColumnContextMenu() {
const context = useContext(PortfolioOverviewContext)
const [open, setOpen] = useState(false)
const isViewAuthor = context.state.currentView?.author === context.props.pageContext.user.email
const userEmail = context.props.pageContext.user.email ?? context.props.pageContext.user.loginName
const isViewAuthor = context.state.currentView?.author === userEmail

const { isAddColumn, createContextualMenuItems } = useAddColumn(
true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ const Icons = {
export function useToolbarItems(context: IPortfolioOverviewContext) {
const userCanManageViews = context.props.configuration.userCanAddViews
const userCanEditGlobalViews = userCanManageViews && context.props.isSiteAdmin
const isViewAuthor =
userCanManageViews && context.state.currentView?.author === context.props.pageContext.user.email
const userEmail = context.props.pageContext.user.email ?? context.props.pageContext.user.loginName
const isViewAuthor = userCanManageViews && context.state.currentView?.author === userEmail

const { exportToExcel } = useExcelExport(context)
const sharedViews = useViewsMenuItems(context, (view) => !view.isPersonal)
Expand Down

0 comments on commit 83f7896

Please sign in to comment.