Skip to content

Commit 14a318e

Browse files
committed
user lock fix
1 parent 13f3e76 commit 14a318e

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

apps/sensenet/src/components/context-menu/use-context-menu-actions.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,18 @@ export function useContextMenuActions(content: GenericContent, setActions: (cont
162162
logger.warning({ message: `Couldn't undo checkout for ${getContentName()}`, data: { error } })
163163
}
164164
break
165+
case 'ForceUndoCheckOut':
166+
try {
167+
const forceUndoCheckOutResult = await repository.versioning.forceUndoCheckOut(
168+
content.Id,
169+
contextMenuODataOptions,
170+
)
171+
logger.information({ message: `${getContentName()} force reverted successfully.` })
172+
setActions(forceUndoCheckOutResult.d)
173+
} catch (error) {
174+
logger.warning({ message: `Couldn't force undo checkout for ${getContentName()}`, data: { error } })
175+
}
176+
break
165177
case 'Approve':
166178
openDialog({
167179
name: 'approve',

apps/sensenet/src/components/dialogs/operations.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Button, createStyles, DialogActions, DialogContent, makeStyles, TextField } from '@material-ui/core'
22
import { GenericContent } from '@sensenet/default-content-types'
3-
import { useLogger, useRepository } from '@sensenet/hooks-react'
3+
import { useLogger, useRepository, useSession } from '@sensenet/hooks-react'
44
import React, { useEffect, useRef, useState } from 'react'
55
import { useCurrentUser } from '../../context'
66
import { useGlobalStyles } from '../../globalStyles'
@@ -52,7 +52,7 @@ const useStyles = makeStyles(() =>
5252

5353
export function OperationsDialog(props: OperationsDialogProps) {
5454
const { closeLastDialog } = useDialog()
55-
const currentUser = useCurrentUser()
55+
const { currentUser } = useSession()
5656
const classes = useStyles()
5757
const logger = useLogger('Operations')
5858
const formRef = useRef<HTMLFormElement>(null)
@@ -66,7 +66,7 @@ export function OperationsDialog(props: OperationsDialogProps) {
6666
const loadOperation = async () => {
6767
try {
6868
const result = await repository.executeAction<any, UIDescription>({
69-
method: 'GET',
69+
method: 'POST',
7070
idOrPath: props.content.Path,
7171
name: props.OperationName,
7272
})
@@ -131,7 +131,7 @@ export function OperationsDialog(props: OperationsDialogProps) {
131131
onSubmit={(e) => {
132132
submitAction(e)
133133
}}>
134-
{UIDescription?.elements.map((field, index) => {
134+
{UIDescription?.elements?.map((field, index) => {
135135
const { inputProps, description, name } = field
136136

137137
return (

0 commit comments

Comments
 (0)