Merge branch 'stable-3.1' into stable-3.2

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

Change-Id: If8b1d38adf900f1fc793c440bf30e50125e4e1a7
This commit is contained in:
Prudhvi Akhil Alahari 2021-05-27 16:00:57 +05:30
commit 4f2c9711e4
2 changed files with 10 additions and 2 deletions

View File

@ -1011,7 +1011,7 @@ public class ChangeData {
}
draftsByUser = new HashMap<>();
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

@ -108,7 +108,15 @@ public class EqualsLabelPredicate extends ChangeIndexPredicate {
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;
}