Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Commit

Permalink
update to volto 14
Browse files Browse the repository at this point in the history
  • Loading branch information
nileshgulia1 committed Nov 8, 2021
1 parent 7764b3a commit 32c2318
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"raven-js": "3.27.2",
"recharts": "2.1.6",
"react-highlight-words": "^0.16.0",
"react-image-gallery": "1.0.8",
"react-image-gallery": "1.2.7",
"react-lazy-load-image-component": "^1.5.0",
"react-stickynode": "^2.1.1",
"react-toastify": "^5.3.2",
Expand Down
44 changes: 44 additions & 0 deletions src/customizations/volto/actions/content/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
ORDER_CONTENT,
RESET_CONTENT,
UPDATECOLUMNS_CONTENT,
LOCK_CONTENT,
UNLOCK_CONTENT,
} from '@plone/volto/constants/ActionTypes';
import { nestContent } from '@plone/volto/helpers';
import config from '@plone/volto/registry';
Expand Down Expand Up @@ -199,3 +201,45 @@ export function updateColumnsContent(url, index) {
indexcolumns: index,
};
}

/**
* Lock content function.
* @function lockContent
* @param {string} urls Content url(s)
* @returns {Object} Lock content action.
*/
export function lockContent(urls) {
return {
type: LOCK_CONTENT,
mode: 'serial',
request:
typeof urls === 'string'
? { op: 'post', path: `${urls}/@lock` }
: urls.map((url) => ({ op: 'post', path: `${url}/@lock` })),
};
}

/**
* Unlock content function.
* @function unlockContent
* @param {string|Array} urls Content url(s).
* @returns {Object} Unlock content action.
*/
export function unlockContent(urls, force = false) {
return {
type: UNLOCK_CONTENT,
mode: 'serial',
request:
typeof urls === 'string'
? {
op: 'del',
path: `${urls}/@lock`,
data: force ? { force: true } : {},
}
: urls.map((url) => ({
op: 'del',
path: `${url}/@lock`,
data: force ? { force: true } : {},
})),
};
}

0 comments on commit 32c2318

Please sign in to comment.