Create ChangeUpdates with ChangeControls
This simplifies the factory methods, since ChangeControl ties a user to a change. It also means all the factory methods can be used without depending on an injected IdentifiedUser. The only thing it complicates slightly is tests. ChangeControl is much more than just a pair of (Change, User), so producing a fully-working ChangeControl is infeasible. Instead, use EasyMock to create a stub only exposing the getters we need. (This is slightly fragile but probably no more so than tying ourselves to one set of injected dependencies.) Change-Id: I7c88d0e7f0e7ea7777adef201325e27810dc0ca7
This commit is contained in:
@@ -221,7 +221,7 @@ public class PostReviewers implements RestModifyView<ChangeResource, AddReviewer
|
||||
Map<Account.Id, ChangeControl> reviewers)
|
||||
throws OrmException, EmailException, IOException {
|
||||
ReviewDb db = dbProvider.get();
|
||||
ChangeUpdate update = updateFactory.create(rsrc.getChange());
|
||||
ChangeUpdate update = updateFactory.create(rsrc.getControl());
|
||||
List<PatchSetApproval> added;
|
||||
db.changes().beginTransaction(rsrc.getChange().getId());
|
||||
try {
|
||||
|
Reference in New Issue
Block a user