Make change notes nullable in suggestReviewer

A recent change broke the reviewers plugin by requiring change notes for
each suggestion. This commit makes change notes nullable and informs
reviewer suggestion plugins about the project name key in addition to
the nullable change notes such that they always have a point of
reference.

Change-Id: I24c42433a2414d1df25290e80012fbb5ee5f4484
This commit is contained in:
Patrick Hiesel
2016-10-13 09:34:44 +02:00
parent 69c74e68c7
commit 2514e41150
3 changed files with 24 additions and 14 deletions

View File

@@ -2417,18 +2417,21 @@ weight config parameter on [addreviewer "<pluginName-exportName>"].
[source, java]
----
import com.google.gerrit.server.change.ReviewerSuggestion;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.extensions.annotations.ExtensionPoint;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Project;
import java.util.Set;
public class MyPlugin implements ReviewerSuggestion {
public Set<SuggestedReviewer> suggestReviewers(
Change.Id changeId, String query, Set<Account.Id> candidates){
Set<SuggestedReviewer> suggestions = new HashSet<>();
// Implement your ranking logic here
return suggestions;
public Set<SuggestedReviewer> suggestReviewers(Project.NameKey project,
@Nullable Change.Id changeId, @Nullable String query,
Set<Account.Id> candidates) {
Set<SuggestedReviewer> suggestions = new HashSet<>();
// Implement your ranking logic here
return suggestions;
}
}
----