Skip to content
Snippets Groups Projects
Commit 8ba39fe3 authored by Sebastian Mihalache's avatar Sebastian Mihalache
Browse files

fix(component-invite): reviewer decline broke status

parent a180d4b2
No related branches found
No related tags found
1 merge request!13Sprint #14
const last = require('lodash/last')
class Collection {
constructor({ collection = {} }) {
this.collection = collection
......@@ -73,8 +75,8 @@ class Collection {
await this.updateStatus({ newStatus: status })
}
async updateStatusByNumberOfReviewers() {
const reviewerInvitations = this.collection.invitations.filter(
async updateStatusByNumberOfReviewers({ invitations }) {
const reviewerInvitations = invitations.filter(
inv => inv.role === 'reviewer',
)
if (reviewerInvitations.length === 0)
......
......@@ -78,7 +78,10 @@ module.exports = models => async (req, res) => {
if (reason) invitation.reason = reason
await fragment.save()
collectionHelper.updateStatusByNumberOfReviewers()
collectionHelper.updateStatusByNumberOfReviewers({
invitations: fragment.invitations,
})
emailHelper.setupReviewerDecisionEmail({
agree: false,
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