protected void assertNoSubmitter(String changeId, int psId) throws OrmException { ChangeNotes cn = notesFactory.create(getOnlyElement(queryProvider.get().byKeyPrefix(changeId)).change()); PatchSetApproval submitter = approvalsUtil.getSubmitter(db, cn, new PatchSet.Id(cn.getChangeId(), psId)); assertThat(submitter).isNull(); }
protected boolean isVisibleTo(Event event, CurrentUser user) throws OrmException { if (event instanceof RefEvent) { RefEvent refEvent = (RefEvent) event; String ref = refEvent.getRefName(); if (PatchSet.isChangeRef(ref)) { Change.Id cid = PatchSet.Id.fromRef(ref).getParentKey(); Change change = notesFactory.create(dbProvider.get(), refEvent.getProjectNameKey(), cid).getChange(); return isVisibleTo(change, user); } return isVisibleTo(refEvent.getBranchNameKey(), user); } else if (event instanceof ProjectEvent) { return isVisibleTo(((ProjectEvent) event).getProjectNameKey(), user); } return true; }