Remove reviewers from a change

- The new UI adds a "Remove" column and an "X" button on each
  reviewer row to ApprovalTable.  Clicking this button will cause
  a remote call to removeReviewer

- Added a new removeReviewer remote method to PatchDetailService

- Both the addReviewer and removeReviewer remote methods use the
  same result class, which I renamed from AddReviewerResult to
  ReviewerResult

- ReviewerResult received a new error type "COULD_NOT_REMOVE"

Note: the error handling of this CL is not optimal for 2 reasons:

- Since PatchDetailService always catches exceptions and adds them
  to an errors field in ReviewerResult, the call always succeeds
  even if it actually failed.

- We can display a dialog box if the removal failed, but it would
  be better simply not to display the Delete button if the user
  doesn't have enough privileges.

A cleaner way to implement this (future change list) would be to
return this information in ChangeDetail so that ChangeScreen will
only display Delete buttons that will actually work.

Bug: issue 218
Bug: issue 289
Change-Id: I38ce63d76a3588c85472f1fd723cd097aeafccb3
This commit is contained in:
Cedric Beust
2010-04-08 13:01:12 -07:00
committed by Shawn O. Pearce
parent 9d823b2e3e
commit 258f15ea85
13 changed files with 202 additions and 23 deletions

View File

@@ -50,7 +50,11 @@ public interface PatchDetailService extends RemoteJsonService {
@SignInRequired
void addReviewers(Change.Id id, List<String> reviewers,
AsyncCallback<AddReviewerResult> callback);
AsyncCallback<ReviewerResult> callback);
@SignInRequired
void removeReviewer(Change.Id id, Account.Id reviewerId,
AsyncCallback<ReviewerResult> callback);
void userApprovals(Set<Change.Id> cids, Account.Id aid,
AsyncCallback<ApprovalSummarySet> callback);

View File

@@ -18,12 +18,14 @@ package com.google.gerrit.common.data;
import java.util.ArrayList;
import java.util.List;
/** Result from adding a reviewer to a change. */
public class AddReviewerResult {
/**
* Result from adding or removing a reviewer from a change.
*/
public class ReviewerResult {
protected List<Error> errors;
protected ChangeDetail change;
public AddReviewerResult() {
public ReviewerResult() {
errors = new ArrayList<Error>();
}
@@ -49,7 +51,10 @@ public class AddReviewerResult {
ACCOUNT_NOT_FOUND,
/** The account is not permitted to see the change. */
CHANGE_NOT_VISIBLE
CHANGE_NOT_VISIBLE,
/** Could not remove this reviewer from the change. */
COULD_NOT_REMOVE
}
protected Type type;