Remove RemoveFromAttentionSetInput

RemoveFromAttentionSetInput was previously used by
RemoveFromAttentionSet. Now, postReview uses AttentionSetInput for both
adding and removing users, so it makes sense to use AttentionSetInput
for both use cases here, as well.

In this case, we will ensure that if a user is specified, it must match
the user in the URL.

The URL looks like this:
POST /changes/{change-id}/attention/{account-id}/delete

Thus, the user that should be removed is already specified there: if
the caller specifies the user again, the users specified must match
to the same user (both in the input object and in the URL).

Change-Id: I68ee52d4e71fd733e0035bee14d3d38ebcdc9752
This commit is contained in:
Gal Paikin
2020-06-16 13:43:53 +03:00
parent 739d28add8
commit 59963899c2
7 changed files with 71 additions and 60 deletions

View File

@@ -17,7 +17,7 @@ package com.google.gerrit.server.api.changes;
import static com.google.gerrit.server.api.ApiUtil.asRestApiException;
import com.google.gerrit.extensions.api.changes.AttentionSetApi;
import com.google.gerrit.extensions.api.changes.RemoveFromAttentionSetInput;
import com.google.gerrit.extensions.api.changes.AttentionSetInput;
import com.google.gerrit.extensions.restapi.RestApiException;
import com.google.gerrit.server.change.AttentionSetEntryResource;
import com.google.gerrit.server.restapi.change.RemoveFromAttentionSet;
@@ -41,7 +41,7 @@ public class AttentionSetApiImpl implements AttentionSetApi {
}
@Override
public void remove(RemoveFromAttentionSetInput input) throws RestApiException {
public void remove(AttentionSetInput input) throws RestApiException {
try {
removeFromAttentionSet.apply(attentionSetEntryResource, input);
} catch (Exception e) {