in plugin/src/com/microsoft/alm/plugin/idea/git/ui/pullrequest/PRTreeCellRenderer.java [77:136]
private void setStatus(final PRTreeNodeForm prView, final GitPullRequest pullRequest) {
//first check merge status, if there are conflicts, show that to the user
final PullRequestAsyncStatus mergeStatus = pullRequest.getMergeStatus();
if (mergeStatus == PullRequestAsyncStatus.CONFLICTS ||
mergeStatus == PullRequestAsyncStatus.FAILURE ||
mergeStatus == PullRequestAsyncStatus.REJECTED_BY_POLICY) {
//merge failed
prView.setStatus(pullRequest.getTitle(),
TfPluginBundle.message(TfPluginBundle.KEY_VCS_PR_MERGE_FAILED),
Icons.PR_STATUS_FAILED);
return;
}
//no merge errors, so look at reviewer response
short lowestVote = 0;
short highestVote = 0;
if (pullRequest.getReviewers() != null && pullRequest.getReviewers().length > 0) {
for (final IdentityRefWithVote reviewer : pullRequest.getReviewers()) {
final short vote = reviewer.getVote();
if (vote < lowestVote) {
lowestVote = vote;
}
if (vote > highestVote) {
highestVote = vote;
}
}
}
short finalVote = REVIEWER_VOTE_NO_RESPONSE;
if (lowestVote < REVIEWER_VOTE_NO_RESPONSE) {
//use negative comments if any
finalVote = lowestVote;
} else if (highestVote > REVIEWER_VOTE_NO_RESPONSE) {
//use positive comments
finalVote = highestVote;
}
//set message and icon based on aggregate reviewers response
String voteString = TfPluginBundle.message(TfPluginBundle.KEY_VCS_PR_REVIEWER_NO_RESPONSE);
Icon voteIcon = Icons.PR_STATUS_NO_RESPONSE;
if (finalVote == REVIEWER_VOTE_APPROVED_WITH_SUGGESTIONS) {
voteString = TfPluginBundle.message(TfPluginBundle.KEY_VCS_PR_REVIEWER_APPROVED_SUGGESTIONS);
voteIcon = Icons.PR_STATUS_SUCCEEDED;
}
if (finalVote == REVIEWER_VOTE_APPROVED) {
voteString = TfPluginBundle.message(TfPluginBundle.KEY_VCS_PR_REVIEWER_APPROVED);
voteIcon = Icons.PR_STATUS_SUCCEEDED;
}
if (finalVote == REVIEWER_VOTE_WAITING_FOR_AUTHOR) {
voteString = TfPluginBundle.message(TfPluginBundle.KEY_VCS_PR_REVIEWER_WAITING);
voteIcon = Icons.PR_STATUS_WAITING;
}
if (finalVote == REVIEWER_VOTE_REJECTED) {
voteString = TfPluginBundle.message(TfPluginBundle.KEY_VCS_PR_REVIEWER_REJECTED);
voteIcon = Icons.PR_STATUS_FAILED;
}
prView.setStatus(pullRequest.getTitle(), voteString, voteIcon);
}