private void ccApprovals(final boolean includeZero) { try { // CC anyone else who has posted an approval mark on this change // for (PatchSetApproval ap : args.db.get().patchSetApprovals().byChange(change.getId())) { if (!includeZero && ap.getValue() == 0) { continue; } add(RecipientType.CC, ap.getAccountId()); } } catch (OrmException err) { } }
private void assertScoreIsAllowed( final PatchSet.Id patchSetId, final ChangeControl changeControl, ApproveOption ao, Short v) throws UnloggedFailure { final PatchSetApproval psa = new PatchSetApproval( new PatchSetApproval.Key(patchSetId, currentUser.getAccountId(), ao.getCategoryId()), v); final FunctionState fs = functionStateFactory.create( changeControl.getChange(), patchSetId, Collections.<PatchSetApproval>emptyList()); psa.setValue(v); fs.normalize(approvalTypes.byId(psa.getCategoryId()), psa); if (v != psa.getValue()) { throw error(ao.name() + "=" + ao.value() + " not permitted"); } }
/** Format the message body by calling {@link #appendText(String)}. */ protected void format() throws EmailException { formatChange(); appendText(velocifyFile("ChangeFooter.vm")); try { HashSet<Account.Id> reviewers = new HashSet<Account.Id>(); for (PatchSetApproval p : args.db.get().patchSetApprovals().byChange(change.getId())) { reviewers.add(p.getAccountId()); } TreeSet<String> names = new TreeSet<String>(); for (Account.Id who : reviewers) { names.add(getNameEmailFor(who)); } for (String name : names) { appendText("Gerrit-Reviewer: " + name + "\n"); } } catch (OrmException e) { } }