Rename AddToAttentionSetInput to AttentionSetInput
This is because in the follow-up change, we will use AttentionSetInput for both adding and removing users from the attention set. However, RemoveFromAttentionSet doesn't work for this case since we need the user to be a part of the input. Also, in a follow-up change, we can consider removing RemoveFromAttentionSetInput and only use AttentionSetInput. Change-Id: I28ba68a24242010f980f8ac833898f433af810e6
This commit is contained in:
@@ -16,6 +16,7 @@ package com.google.gerrit.entities;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import com.google.gerrit.common.Nullable;
|
||||
import com.google.gerrit.extensions.api.changes.AttentionSetInput;
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
@@ -23,7 +24,7 @@ import java.time.Instant;
|
||||
* in reverse chronological order. Since each update contains all required information and
|
||||
* invalidates all previous state, only the most recent record is relevant for each user.
|
||||
*
|
||||
* <p>See {@link com.google.gerrit.extensions.api.changes.AddToAttentionSetInput} and {@link
|
||||
* <p>See {@link AttentionSetInput} and {@link
|
||||
* com.google.gerrit.extensions.api.changes.RemoveFromAttentionSetInput} for the representation in
|
||||
* the API.
|
||||
*/
|
||||
|
||||
@@ -20,14 +20,14 @@ package com.google.gerrit.extensions.api.changes;
|
||||
* @see RemoveFromAttentionSetInput
|
||||
* @see com.google.gerrit.extensions.common.AttentionSetEntry
|
||||
*/
|
||||
public class AddToAttentionSetInput {
|
||||
public class AttentionSetInput {
|
||||
public String user;
|
||||
public String reason;
|
||||
|
||||
public AddToAttentionSetInput(String user, String reason) {
|
||||
public AttentionSetInput(String user, String reason) {
|
||||
this.user = user;
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public AddToAttentionSetInput() {}
|
||||
public AttentionSetInput() {}
|
||||
}
|
||||
@@ -302,7 +302,7 @@ public interface ChangeApi {
|
||||
AttentionSetApi attention(String id) throws RestApiException;
|
||||
|
||||
/** Adds a user to the attention set. */
|
||||
AccountInfo addToAttentionSet(AddToAttentionSetInput input) throws RestApiException;
|
||||
AccountInfo addToAttentionSet(AttentionSetInput input) throws RestApiException;
|
||||
|
||||
/** Set the assignee of a change. */
|
||||
AccountInfo setAssignee(AssigneeInput input) throws RestApiException;
|
||||
@@ -578,7 +578,7 @@ public interface ChangeApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountInfo addToAttentionSet(AddToAttentionSetInput input) throws RestApiException {
|
||||
public AccountInfo addToAttentionSet(AttentionSetInput input) throws RestApiException {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import com.google.gerrit.extensions.restapi.DefaultInput;
|
||||
/**
|
||||
* Input at API level to remove a user from the attention set.
|
||||
*
|
||||
* @see AddToAttentionSetInput
|
||||
* @see AttentionSetInput
|
||||
* @see com.google.gerrit.extensions.common.AttentionSetEntry
|
||||
*/
|
||||
public class RemoveFromAttentionSetInput {
|
||||
|
||||
@@ -23,9 +23,9 @@ import com.google.gerrit.exceptions.StorageException;
|
||||
import com.google.gerrit.extensions.api.changes.AbandonInput;
|
||||
import com.google.gerrit.extensions.api.changes.AddReviewerInput;
|
||||
import com.google.gerrit.extensions.api.changes.AddReviewerResult;
|
||||
import com.google.gerrit.extensions.api.changes.AddToAttentionSetInput;
|
||||
import com.google.gerrit.extensions.api.changes.AssigneeInput;
|
||||
import com.google.gerrit.extensions.api.changes.AttentionSetApi;
|
||||
import com.google.gerrit.extensions.api.changes.AttentionSetInput;
|
||||
import com.google.gerrit.extensions.api.changes.ChangeApi;
|
||||
import com.google.gerrit.extensions.api.changes.ChangeEditApi;
|
||||
import com.google.gerrit.extensions.api.changes.ChangeMessageApi;
|
||||
@@ -543,7 +543,7 @@ class ChangeApiImpl implements ChangeApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountInfo addToAttentionSet(AddToAttentionSetInput input) throws RestApiException {
|
||||
public AccountInfo addToAttentionSet(AttentionSetInput input) throws RestApiException {
|
||||
try {
|
||||
return addToAttentionSet.apply(change, input).value();
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -16,7 +16,7 @@ package com.google.gerrit.server.restapi.change;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.gerrit.entities.Account;
|
||||
import com.google.gerrit.extensions.api.changes.AddToAttentionSetInput;
|
||||
import com.google.gerrit.extensions.api.changes.AttentionSetInput;
|
||||
import com.google.gerrit.extensions.common.AccountInfo;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.BadRequestException;
|
||||
@@ -38,7 +38,7 @@ import com.google.inject.Singleton;
|
||||
@Singleton
|
||||
public class AddToAttentionSet
|
||||
implements RestCollectionModifyView<
|
||||
ChangeResource, AttentionSetEntryResource, AddToAttentionSetInput> {
|
||||
ChangeResource, AttentionSetEntryResource, AttentionSetInput> {
|
||||
private final BatchUpdate.Factory updateFactory;
|
||||
private final AccountResolver accountResolver;
|
||||
private final AddToAttentionSetOp.Factory opFactory;
|
||||
@@ -60,7 +60,7 @@ public class AddToAttentionSet
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response<AccountInfo> apply(ChangeResource changeResource, AddToAttentionSetInput input)
|
||||
public Response<AccountInfo> apply(ChangeResource changeResource, AttentionSetInput input)
|
||||
throws Exception {
|
||||
input.user = Strings.nullToEmpty(input.user).trim();
|
||||
if (input.user.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user