Remove old setReviewedByCurrentUser RPC endpoint
Change-Id: I9d3133d2036956dbf747a52cffc4c686ee58ca4c
This commit is contained in:
parent
a5342a167a
commit
f2ed5a5c9b
@ -20,7 +20,6 @@ import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.AccountDiffPreference;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Patch;
|
||||
import com.google.gerrit.reviewdb.client.Patch.Key;
|
||||
import com.google.gerrit.reviewdb.client.PatchLineComment;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gwtjsonrpc.common.AsyncCallback;
|
||||
@ -79,11 +78,4 @@ public interface PatchDetailService extends RemoteJsonService {
|
||||
|
||||
void strongestApprovals(Set<Change.Id> cids,
|
||||
AsyncCallback<ApprovalSummarySet> callback);
|
||||
|
||||
/**
|
||||
* Update the reviewed status for the patch.
|
||||
*/
|
||||
@Audit
|
||||
@SignInRequired
|
||||
void setReviewedByCurrentUser(Key patchKey, boolean reviewed, AsyncCallback<VoidResult> callback);
|
||||
}
|
||||
|
@ -27,11 +27,9 @@ import com.google.gerrit.httpd.rpc.BaseServiceImplementation;
|
||||
import com.google.gerrit.httpd.rpc.changedetail.ChangeDetailFactory;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.AccountDiffPreference;
|
||||
import com.google.gerrit.reviewdb.client.AccountPatchReview;
|
||||
import com.google.gerrit.reviewdb.client.ApprovalCategory;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Patch;
|
||||
import com.google.gerrit.reviewdb.client.Patch.Key;
|
||||
import com.google.gerrit.reviewdb.client.PatchLineComment;
|
||||
import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gerrit.reviewdb.client.PatchSetApproval;
|
||||
@ -172,34 +170,6 @@ class PatchDetailServiceImpl extends BaseServiceImplementation implements
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the reviewed status for the file by user @code{account}
|
||||
*/
|
||||
public void setReviewedByCurrentUser(final Key patchKey,
|
||||
final boolean reviewed, AsyncCallback<VoidResult> callback) {
|
||||
run(callback, new Action<VoidResult>() {
|
||||
public VoidResult run(ReviewDb db) throws OrmException {
|
||||
Account.Id account = getAccountId();
|
||||
AccountPatchReview.Key key =
|
||||
new AccountPatchReview.Key(patchKey, account);
|
||||
db.accounts().beginTransaction(account);
|
||||
try {
|
||||
AccountPatchReview apr = db.accountPatchReviews().get(key);
|
||||
if (apr == null && reviewed) {
|
||||
db.accountPatchReviews().insert(
|
||||
Collections.singleton(new AccountPatchReview(patchKey, account)));
|
||||
} else if (apr != null && !reviewed) {
|
||||
db.accountPatchReviews().delete(Collections.singleton(apr));
|
||||
}
|
||||
db.commit();
|
||||
return VoidResult.INSTANCE;
|
||||
} finally {
|
||||
db.rollback();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void addReviewers(final Change.Id id, final List<String> reviewers,
|
||||
final boolean confirmed, final AsyncCallback<ReviewerResult> callback) {
|
||||
addReviewerHandlerFactory.create(id, reviewers, confirmed).to(callback);
|
||||
|
Loading…
Reference in New Issue
Block a user