SetAssigneeOp fails to detect identical assignee.
Also removed unnecessary null checks for optional objects. Change-Id: Ia1f6218b75dcaea751c089eab29a5a285c2c6b8d
This commit is contained in:

committed by
David Pursehouse

parent
cc6a0cd4ee
commit
0e907f9812
@@ -78,18 +78,18 @@ public class SetAssigneeOp extends BatchUpdate.Op {
|
|||||||
Optional<Account.Id> oldAssigneeId =
|
Optional<Account.Id> oldAssigneeId =
|
||||||
Optional.fromNullable(ctx.getChange().getAssignee());
|
Optional.fromNullable(ctx.getChange().getAssignee());
|
||||||
if (input.assignee == null) {
|
if (input.assignee == null) {
|
||||||
if (oldAssigneeId != null && oldAssigneeId.isPresent()) {
|
if (oldAssigneeId.isPresent()) {
|
||||||
throw new BadRequestException("Cannot set Assignee to empty");
|
throw new BadRequestException("Cannot set Assignee to empty");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Account oldAssignee = null;
|
Account oldAssignee = null;
|
||||||
if (oldAssigneeId != null && oldAssigneeId.isPresent()) {
|
if (oldAssigneeId.isPresent()) {
|
||||||
oldAssignee = accountInfosFactory.create().get(oldAssigneeId.get());
|
oldAssignee = accountInfosFactory.create().get(oldAssigneeId.get());
|
||||||
}
|
}
|
||||||
IdentifiedUser newAssigneeUser = accounts.parse(input.assignee);
|
IdentifiedUser newAssigneeUser = accounts.parse(input.assignee);
|
||||||
if (oldAssigneeId != null &&
|
if (oldAssigneeId.isPresent() &&
|
||||||
oldAssigneeId.equals(newAssigneeUser.getAccountId())) {
|
oldAssigneeId.get().equals(newAssigneeUser.getAccountId())) {
|
||||||
newAssignee = oldAssignee;
|
newAssignee = oldAssignee;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user