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