Hoist validation from SetAssigneeOp into PutAssignee

Performing validation of the new asignee inside the operation isn't
necessary; it can be validated in the REST API handler as its parsing
the input object and preparing the operation object.  This
signficantly cleans up the operation object, making it easier to
follow the logic.

This change also makes it easier to later refactor the check "can new
assignee see the target branch", before the operation is even started.

Change-Id: I3c8f3459300a670e8c76edff1262399de704933b
This commit is contained in:
Shawn Pearce
2017-02-23 22:32:23 -08:00
committed by David Pursehouse
parent 4778db67da
commit 8ca95f4e25
3 changed files with 47 additions and 54 deletions

View File

@@ -492,7 +492,7 @@ class ChangeApiImpl implements ChangeApi {
@Override
public AccountInfo setAssignee(AssigneeInput input) throws RestApiException {
try {
return putAssignee.apply(change, input).value();
return putAssignee.apply(change, input);
} catch (UpdateException | IOException | OrmException e) {
throw new RestApiException("Cannot set assignee", e);
}