Skip to content
Snippets Groups Projects
Commit 9db7150c authored by Nicoleta Ursu's avatar Nicoleta Ursu
Browse files

fix: server shouldn't send confidential comments to author

parent 7c325119
No related branches found
No related tags found
No related merge requests found
......@@ -461,7 +461,7 @@ const resolvers = {
async manuscript(_, { id }, ctx) {
// eslint-disable-next-line global-require
const ManuscriptModel = require('./manuscript') // Pubsweet models may initially be undefined, so we require only when resolver runs.
const manuscript = await ManuscriptModel.query()
.findById(id)
.withGraphFetched(
......@@ -488,6 +488,17 @@ const resolvers = {
// manuscript.channel = await ctx.connectors.Channel.model.find(
// manuscript.channelId,
// )
if (!ctx.user.admin) {
const manuscriptObj = Object.assign({}, manuscript)
manuscriptObj.reviews.forEach((review, index) => {
delete manuscriptObj.reviews[index].confidentialComment
})
return manuscriptObj
}
return manuscript
},
async manuscripts(_, { where }, ctx) {
......
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