Skip to content

Commit

Permalink
Automatic review should only have one revision in review pending state (
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenkuttappan committed Mar 31, 2021
1 parent 9e53123 commit 8c6b96c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/dotnet/APIView/APIViewWeb/Repositories/ReviewManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,14 @@ public async Task<ReviewModel> CreateMasterReviewAsync(ClaimsPrincipal user, str
await AssertAutomaticReviewModifier(user, review);
if (createNewRevision)
{
// Delete last revision if it is not in approved state before adding new revision
// This is to keep only one pending revision since last approval or from initial review revision
var lastRevision = review.Revisions.LastOrDefault();
if (lastRevision != null && lastRevision.Approvers.Count == 0 && review.Revisions.Count > 1)
{
review.Revisions.Remove(lastRevision);
}

// Update or insert review with new revision
var revision = new ReviewRevisionModel()
{
Expand Down

0 comments on commit 8c6b96c

Please sign in to comment.