diff --git a/src/main/java/org/jenkinsci/plugins/ghprb/GhprbPullRequest.java b/src/main/java/org/jenkinsci/plugins/ghprb/GhprbPullRequest.java index 31f9f880f..d77d0a31d 100644 --- a/src/main/java/org/jenkinsci/plugins/ghprb/GhprbPullRequest.java +++ b/src/main/java/org/jenkinsci/plugins/ghprb/GhprbPullRequest.java @@ -98,7 +98,6 @@ private boolean setUpdated(Date lastUpdateTime) { // earlier than the current updated time if (updated == null || updated.compareTo(lastUpdateTime) < 0) { updated = lastUpdateTime; - changed = true; return true; } return false; @@ -219,18 +218,19 @@ private void updatePR(GHPullRequest ghpr, GHIssueComment comment, boolean isWebh comment != null ? "comment" : "PR update"}); } - // Update the PR object with the new pull request object if - // it is non-null. getPullRequest will then avoid another - // GH API call. - if (ghpr != null) { - setPullRequest(ghpr); - } - - // Grab the pull request for use in this method (in case we came in through the comment path) - GHPullRequest pullRequest = getPullRequest(); - synchronized (this) { boolean wasUpdated = setUpdated(updatedDate); + + // Update the PR object with the new pull request object if + // it is non-null. getPullRequest will then avoid another + // GH API call. + if (ghpr != null) { + setPullRequest(ghpr); + } + + // Grab the pull request for use in this method (in case we came in through the comment path) + GHPullRequest pullRequest = getPullRequest(); + // the author of the PR could have been whitelisted since its creation if (!accepted && helper.isWhitelisted(getPullRequestAuthor())) { diff --git a/src/test/java/org/jenkinsci/plugins/ghprb/GhprbRepositoryTest.java b/src/test/java/org/jenkinsci/plugins/ghprb/GhprbRepositoryTest.java index 59d35a614..ba1a07ed4 100644 --- a/src/test/java/org/jenkinsci/plugins/ghprb/GhprbRepositoryTest.java +++ b/src/test/java/org/jenkinsci/plugins/ghprb/GhprbRepositoryTest.java @@ -209,9 +209,9 @@ public void testCheckMethodWithOnlyExistingPRs() throws Exception { verify(ghPullRequest, times(2)).getHead(); verify(ghPullRequest, times(2)).getNumber(); verify(ghPullRequest, times(1)).getUpdatedAt(); - verify(ghPullRequest, times(1)).getCreatedAt(); verify(ghPullRequest, times(1)).getUser(); verify(ghPullRequest, times(1)).getBase(); + verify(ghPullRequest, times(1)).getCommentsCount(); verifyNoMoreInteractions(ghPullRequest); verify(helper).ifOnlyTriggerPhrase();