Submit Requirements - show only trigger labels with votes
+ `hasVotes` function works on both `DetailedLabelInfo` and
`QuickLabelInfo`
Change-Id: I9e42121bd85b840173f749b4e64450559583f479
diff --git a/polygerrit-ui/app/elements/change/gr-submit-requirements/gr-submit-requirements.ts b/polygerrit-ui/app/elements/change/gr-submit-requirements/gr-submit-requirements.ts
index 2175e04..fa590a3 100644
--- a/polygerrit-ui/app/elements/change/gr-submit-requirements/gr-submit-requirements.ts
+++ b/polygerrit-ui/app/elements/change/gr-submit-requirements/gr-submit-requirements.ts
@@ -169,11 +169,7 @@
);
const everyAssociatedLabelsIsWithoutVotes = associatedLabels.every(
- label => {
- const labelInfo = allLabels[label];
- if (!isDetailedLabelInfo(labelInfo)) return true;
- return !hasVotes(labelInfo);
- }
+ label => !hasVotes(allLabels[label])
);
if (everyAssociatedLabelsIsWithoutVotes) return html`No votes`;
@@ -209,9 +205,9 @@
const labelAssociatedWithSubmitReqs = submitReqs
.flatMap(req => extractAssociatedLabels(req))
.filter(unique);
- const triggerVotes = allLabels.filter(
- label => !labelAssociatedWithSubmitReqs.includes(label)
- );
+ const triggerVotes = allLabels
+ .filter(label => !labelAssociatedWithSubmitReqs.includes(label))
+ .filter(label => hasVotes(labels[label]));
if (!triggerVotes.length) return;
return html`<h3 class="metadata-title heading-3">Trigger Votes</h3>
<section class="votes">