From e540a112f79675782c81d64e014dd7db2172108e Mon Sep 17 00:00:00 2001 From: Ben Whitmore <ben.whitmore0@gmail.com> Date: Wed, 31 Mar 2021 16:16:53 +1300 Subject: [PATCH] fix(review): fix a small error in cache update --- app/components/component-review/src/components/ReviewPage.js | 4 ++-- server/model-review/src/graphql.js | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/components/component-review/src/components/ReviewPage.js b/app/components/component-review/src/components/ReviewPage.js index 06d55eb2d5..216f4706cb 100644 --- a/app/components/component-review/src/components/ReviewPage.js +++ b/app/components/component-review/src/components/ReviewPage.js @@ -206,7 +206,7 @@ const ReviewPage = ({ match, ...props }) => { [] ).find(statusTemp => statusTemp.user === currentUser.id) || {} - const updateReview = (review, file) => { + const updateReview = review => { const reviewData = { recommendation: review.recommendation, manuscriptId: manuscript.id, @@ -243,7 +243,7 @@ const ReviewPage = ({ match, ...props }) => { if ( existingReviewRefs.some( - ref => readField('id', ref) === updateReview.id, + ref => readField('id', ref) === updateReviewTemp.id, ) ) { return existingReviewRefs diff --git a/server/model-review/src/graphql.js b/server/model-review/src/graphql.js index a486fef8f3..4b8db5db23 100644 --- a/server/model-review/src/graphql.js +++ b/server/model-review/src/graphql.js @@ -5,8 +5,7 @@ const resolvers = { Mutation: { async updateReview(_, { id, input }, ctx) { // We process comment fields into array - input.user = ctx.user - const processedReview = Object.assign({}, input) + const processedReview = { ...input, user: ctx.user } processedReview.comments = [ input.reviewComment, input.confidentialComment, @@ -34,9 +33,11 @@ const resolvers = { async completeReview(_, { id }, ctx) { const review = await ctx.models.Review.query().findById(id) + const manuscript = await ctx.models.Manuscript.query().findById( review.manuscriptId, ) + const team = await manuscript .$relatedQuery('teams') .where('role', 'reviewer') -- GitLab