Skip to content

Commit

Permalink
Merge pull request #368 from DavidTanner/comments
Browse files Browse the repository at this point in the history
Set the pull request after updating the updated timestamp
  • Loading branch information
DavidTanner authored Jun 21, 2016
2 parents c82fffa + ec18ea0 commit b342d67
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions src/main/java/org/jenkinsci/plugins/ghprb/GhprbPullRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit b342d67

Please sign in to comment.