Merge "Fix error message if assignee is not found"
This commit is contained in:
@@ -23,7 +23,8 @@ public class ChangeMessages extends TranslationBundle {
|
||||
}
|
||||
|
||||
public String revertChangeDefaultMessage;
|
||||
public String reviewerNotFound;
|
||||
public String reviewerNotFoundUser;
|
||||
public String reviewerNotFoundUserOrGroup;
|
||||
|
||||
public String groupIsNotAllowed;
|
||||
public String groupHasTooManyMembers;
|
||||
|
@@ -209,7 +209,7 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
|
||||
reviewerInput.notify = NotifyHandling.NONE;
|
||||
|
||||
PostReviewers.Addition result = postReviewers.prepareApplication(
|
||||
revision.getChangeResource(), reviewerInput);
|
||||
revision.getChangeResource(), reviewerInput, true);
|
||||
reviewerJsonResults.put(reviewerInput.reviewer, result.result);
|
||||
if (result.result.error != null) {
|
||||
hasError = true;
|
||||
|
@@ -147,7 +147,7 @@ public class PostReviewers
|
||||
throw new BadRequestException("missing reviewer field");
|
||||
}
|
||||
|
||||
Addition addition = prepareApplication(rsrc, input);
|
||||
Addition addition = prepareApplication(rsrc, input, true);
|
||||
if (addition.op == null) {
|
||||
return addition.result;
|
||||
}
|
||||
@@ -161,18 +161,24 @@ public class PostReviewers
|
||||
return addition.result;
|
||||
}
|
||||
|
||||
public Addition prepareApplication(ChangeResource rsrc, AddReviewerInput input)
|
||||
throws OrmException, RestApiException, IOException {
|
||||
public Addition prepareApplication(ChangeResource rsrc,
|
||||
AddReviewerInput input, boolean allowGroup)
|
||||
throws OrmException, RestApiException, IOException {
|
||||
Account.Id accountId;
|
||||
try {
|
||||
accountId = accounts.parse(input.reviewer).getAccountId();
|
||||
} catch (UnprocessableEntityException e) {
|
||||
try {
|
||||
return putGroup(rsrc, input);
|
||||
} catch (UnprocessableEntityException e2) {
|
||||
throw new UnprocessableEntityException(MessageFormat
|
||||
.format(ChangeMessages.get().reviewerNotFound, input.reviewer));
|
||||
if (allowGroup) {
|
||||
try {
|
||||
return putGroup(rsrc, input);
|
||||
} catch (UnprocessableEntityException e2) {
|
||||
throw new UnprocessableEntityException(MessageFormat.format(
|
||||
ChangeMessages.get().reviewerNotFoundUserOrGroup,
|
||||
input.reviewer));
|
||||
}
|
||||
}
|
||||
throw new UnprocessableEntityException(MessageFormat
|
||||
.format(ChangeMessages.get().reviewerNotFoundUser, input.reviewer));
|
||||
}
|
||||
return putAccount(input.reviewer, reviewerFactory.create(rsrc, accountId),
|
||||
input.state(), input.notify);
|
||||
|
@@ -91,7 +91,7 @@ public class PutAssignee implements
|
||||
reviewerInput.state = ReviewerState.CC;
|
||||
reviewerInput.confirmed = true;
|
||||
reviewerInput.notify = NotifyHandling.NONE;
|
||||
return postReviewers.prepareApplication(rsrc, reviewerInput);
|
||||
return postReviewers.prepareApplication(rsrc, reviewerInput, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -1,7 +1,8 @@
|
||||
# Changes to this file should also be made in
|
||||
# gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeMessages.properties
|
||||
revertChangeDefaultMessage = Revert \"{0}\"\n\nThis reverts commit {1}.
|
||||
reviewerNotFound = {0} does not identify a registered user or group
|
||||
reviewerNotFoundUser = {0} does not identify a registered user
|
||||
reviewerNotFoundUserOrGroup = {0} does not identify a registered user or group
|
||||
|
||||
groupIsNotAllowed = The group {0} cannot be added as reviewer.
|
||||
groupHasTooManyMembers = The group {0} has too many members to add them all as reviewers.
|
||||
|
Reference in New Issue
Block a user