Merge branch 'stable-2.15' into stable-2.16

* stable-2.15:
  Fix to not throw NPE while accessing draft refs
  EqualsLabelPredicate: Fix bug that prevents matching owner votes

Change-Id: Ieba3fc1cb0ead80a54c3ec55ba6e7f0f574405dc
This commit is contained in:
Prudhvi Akhil Alahari 2021-05-27 10:54:26 +05:30
commit 91b79bec1f
2 changed files with 11 additions and 3 deletions

View File

@ -1078,7 +1078,7 @@ public class ChangeData {
draftsByUser = new HashMap<>();
if (notesMigration.readChanges()) {
for (Ref ref : commentsUtil.getDraftRefs(notes.getChangeId())) {
for (Ref ref : commentsUtil.getDraftRefs(notes().getChangeId())) {
Account.Id account = Account.Id.fromRefSuffix(ref.getName());
if (account != null
// Double-check that any drafts exist for this user after

View File

@ -107,12 +107,20 @@ public class EqualsLabelPredicate extends ChangeIndexPredicate {
return null;
}
protected boolean match(ChangeData cd, short value, Account.Id approver) {
protected boolean match(ChangeData cd, short value, Account.Id approver) throws OrmException {
if (value != expVal) {
return false;
}
if (account != null && !account.equals(approver)) {
if (account != null
&& !account.equals(approver)
&& !account.equals(ChangeQueryBuilder.OWNER_ACCOUNT_ID)) {
return false;
}
if (account != null
&& account.equals(ChangeQueryBuilder.OWNER_ACCOUNT_ID)
&& !cd.change().getOwner().equals(approver)) {
return false;
}