Skip to content
Snippets Groups Projects
Commit a031371b authored by Alexandru Munteanu's avatar Alexandru Munteanu
Browse files

fix(authsome): fix recommendations patch

parent c0d050ac
No related branches found
No related tags found
2 merge requests!13Sprint #14,!11Submit revision
......@@ -29,12 +29,8 @@ module.exports = models => async (req, res) => {
})
const authsome = authsomeHelper.getAuthsome(models)
const authsomeObject =
recommendation.recommendationType === 'editorRecommendation'
? collection
: fragment
const target = {
authsomeObject,
fragment,
path: req.route.path,
}
const canPatch = await authsome.can(req.user, 'PATCH', target)
......
......@@ -139,7 +139,6 @@ const onChange = (
) => {
const newValues = parseReviewRequest(values)
const prevValues = parseReviewRequest(previousValues)
if (!isEqual(newValues, prevValues)) {
dispatch(autosaveRequest())
if (newValues.id) {
......
......@@ -201,7 +201,7 @@ async function authenticatedUser(user, operation, object, context) {
// allow reviewer to patch his recommendation
if (
get(object, 'path') ===
'/api/collections/:collectionId/fragments/:fragmentId/recommendations'
'/api/collections/:collectionId/fragments/:fragmentId/recommendations/:recommendationId'
) {
return helpers.hasPermissionForObject({
user,
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment