Merge "Submit Requirements - show only trigger labels with votes"
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">
diff --git a/polygerrit-ui/app/utils/label-util.ts b/polygerrit-ui/app/utils/label-util.ts
index 066c7cd..cde9a45 100644
--- a/polygerrit-ui/app/utils/label-util.ts
+++ b/polygerrit-ui/app/utils/label-util.ts
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 import {
+  isQuickLabelInfo,
   SubmitRequirementResultInfo,
   SubmitRequirementStatus,
 } from '../api/rest-api';
@@ -121,11 +122,17 @@
   return label.all?.filter(x => x._account_id === account._account_id)[0];
 }
 
-export function hasVotes(labelInfo: DetailedLabelInfo) {
-  return (labelInfo.all ?? []).some(
-    approval =>
-      getLabelStatus(labelInfo, approval.value) !== LabelStatus.NEUTRAL
-  );
+export function hasVotes(labelInfo: LabelInfo): boolean {
+  if (isDetailedLabelInfo(labelInfo)) {
+    return (labelInfo.all ?? []).some(
+      approval =>
+        getLabelStatus(labelInfo, approval.value) !== LabelStatus.NEUTRAL
+    );
+  }
+  if (isQuickLabelInfo(labelInfo)) {
+    return !!labelInfo.rejected || !!labelInfo.approved;
+  }
+  return false;
 }
 
 export function labelCompare(labelName1: string, labelName2: string) {