EmailReviewComments: Provide the current user instead of exception

The review comments are sent in a separate thread, and when invoked by
a context that needs the current user it fails because getCurrentUser()
raises OutOfScopeException.

Modify EmailReciewComments sender and its Factory.create() to accept an
IdentifiedUser rather than an Account.Id, and use it to return from the
getCurrentUser() method instead of throwing an exception.

Test plan:

- Create a group named "test-group", visible to all users.
- Create a project named "test-project".
- As "user-a", add a project watch on "test-project" with the
  search query "label:Code-Review=+1,group=test-group".
- As "user-b", add a Code-Review+1 score on a change on the
  "test-project" project.

Bug: Issue 3882
Change-Id: Iebcded01d7f72156f2b292d7b55848efc6e03dc2
This commit is contained in:
David Pursehouse
2016-02-08 17:10:45 +09:00
parent 478a04fbcb
commit e39cb56881
2 changed files with 9 additions and 10 deletions

View File

@@ -191,7 +191,7 @@ public class PostReview implements RestModifyView<RevisionResource, ReviewInput>
input.notify,
change,
revision.getPatchSet(),
revision.getAccountId(),
revision.getUser(),
message,
comments).sendAsync();
}