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"); } }