diff options
author | Shawn O. Pearce <sop@google.com> | 2009-01-26 12:46:20 -0800 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2009-01-26 13:55:19 -0800 |
commit | 3719858ca83f5f5ab1e49e5497264936d83bd772 (patch) | |
tree | 4e5e0f93d4b0d51124ce0d1fcc8eae135f8e706b | |
parent | 4679770f9a96ffea2c283d25c9fa1e1732f60b83 (diff) |
Make newly created changes show up in reviewer dashboards
Aside from emailing a reviewer with a change notice we also want
to ensure the change is visible in their dashboard, should they
just visit the site directly without following a hyperlink.
To do this we need to ensure at least one ChangeApproval has been
created for the reviewer for this change.
Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r-- | appjar/src/main/java/com/google/gerrit/server/ssh/Receive.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/appjar/src/main/java/com/google/gerrit/server/ssh/Receive.java b/appjar/src/main/java/com/google/gerrit/server/ssh/Receive.java index 2798fccf2c..cbc2ea83e2 100644 --- a/appjar/src/main/java/com/google/gerrit/server/ssh/Receive.java +++ b/appjar/src/main/java/com/google/gerrit/server/ssh/Receive.java @@ -493,6 +493,7 @@ class Receive extends AbstractGitCommand { ChangeUtil.updated(change); db.changes().insert(Collections.singleton(change), txn); + final Set<Account.Id> haveApprovals = new HashSet<Account.Id>(); final List<ApprovalType> allTypes = Common.getGerritConfig().getApprovalTypes(); for (final ApprovalType t : allTypes) { @@ -503,6 +504,7 @@ class Receive extends AbstractGitCommand { change.getId(), me, v.getCategoryId()), v.getValue())), txn); } } + haveApprovals.add(me); if (allTypes.size() > 0) { final Account.Id authorId = @@ -513,16 +515,23 @@ class Receive extends AbstractGitCommand { .getCommitter().getAccount() : null; final ApprovalCategory.Id catId = allTypes.get(allTypes.size() - 1).getCategory().getId(); - if (authorId != null && !me.equals(authorId)) { + if (authorId != null && haveApprovals.add(authorId)) { db.changeApprovals().insert( Collections.singleton(new ChangeApproval(new ChangeApproval.Key( change.getId(), authorId, catId), (short) 0)), txn); } - if (committerId != null && !me.equals(committerId)) { + if (committerId != null && haveApprovals.add(committerId)) { db.changeApprovals().insert( Collections.singleton(new ChangeApproval(new ChangeApproval.Key( change.getId(), committerId, catId), (short) 0)), txn); } + for (final Account.Id reviewer : reviewerId) { + if (haveApprovals.add(reviewer)) { + db.changeApprovals().insert( + Collections.singleton(new ChangeApproval(new ChangeApproval.Key( + change.getId(), reviewer, catId), (short) 0)), txn); + } + } } txn.commit(); |