Skip to content
Snippets Groups Projects
Commit 8017fca9 authored by Jure's avatar Jure
Browse files

test: fetch Manuscript from context.models

parent 6fde33a5
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,11 @@ module.exports = async (userId, operation, object, context) => {
}
if (operation === 'publishManuscript') {
const isAuthor = object.current.owners.includes(user.id)
// Try to fetch the current Manuscript using the context
// to verify that you can, in fact, do it.
const manuscript = await context.models.Manuscript.find(object.current.id)
const isAuthor = manuscript.owners.includes(user.id)
if (isAuthor && user.admin) {
return true
} else if (isAuthor) {
......
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