SuggestService visibility logic updated.

The SuggestService previously used the project to determine if a
suggested user should be returned. The RPC was updated to use the
change to determine if a suggested user can see the change. This
is implemented as a new RPC, deprecating the old one, so the API
does not break unexpectly for direct API users.

This change is moving toward the goal of not using
GroupMembership.getKnownGroups(), so as to support almost any group
system.

Change-Id: I63a8bca720d0cc77b4a9f3820e1d6ebe8966afc4
This commit is contained in:
Colby Ranger
2012-04-05 11:10:01 -07:00
parent 3c682e3a04
commit bd564c810c
4 changed files with 71 additions and 24 deletions

View File

@@ -134,13 +134,12 @@ public class ApprovalTable extends Composite {
}
void display(ChangeDetail detail) {
reviewerSuggestOracle.setProject(detail.getChange().getProject());
changeId = detail.getChange().getId();
reviewerSuggestOracle.setChange(changeId);
List<String> columns = new ArrayList<String>();
List<ApprovalDetail> rows = detail.getApprovals();
changeId = detail.getChange().getId();
final Element missingList = missing.getElement();
while (DOM.getChildCount(missingList) > 0) {
DOM.removeChild(missingList, DOM.getChild(missingList, 0));

View File

@@ -20,7 +20,7 @@ import com.google.gerrit.client.admin.Util;
import com.google.gerrit.client.rpc.GerritCallback;
import com.google.gerrit.common.data.AccountInfo;
import com.google.gerrit.common.data.ReviewerInfo;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gwt.user.client.ui.SuggestOracle;
import com.google.gwtexpui.safehtml.client.HighlightSuggestOracle;
@@ -30,13 +30,13 @@ import java.util.List;
/** Suggestion Oracle for reviewers. */
public class ReviewerSuggestOracle extends HighlightSuggestOracle {
private Project.NameKey project;
private Change.Id changeId;
@Override
protected void onRequestSuggestions(final Request req, final Callback callback) {
RpcStatus.hide(new Runnable() {
public void run() {
SuggestUtil.SVC.suggestReviewer(project, req.getQuery(),
SuggestUtil.SVC.suggestChangeReviewer(changeId, req.getQuery(),
req.getLimit(), new GerritCallback<List<ReviewerInfo>>() {
public void onSuccess(final List<ReviewerInfo> result) {
final List<ReviewerSuggestion> r =
@@ -52,8 +52,8 @@ public class ReviewerSuggestOracle extends HighlightSuggestOracle {
});
}
public void setProject(final Project.NameKey project) {
this.project = project;
public void setChange(Change.Id changeId) {
this.changeId = changeId;
}
private static class ReviewerSuggestion implements SuggestOracle.Suggestion {