Merge "Allow making code owner approvals sticky per file"
diff --git a/java/com/google/gerrit/plugins/codeowners/restapi/GetOwnedPaths.java b/java/com/google/gerrit/plugins/codeowners/restapi/GetOwnedPaths.java
index eda1ee9..bab4ac7 100644
--- a/java/com/google/gerrit/plugins/codeowners/restapi/GetOwnedPaths.java
+++ b/java/com/google/gerrit/plugins/codeowners/restapi/GetOwnedPaths.java
@@ -19,7 +19,6 @@
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Streams;
 import com.google.gerrit.entities.Account;
 import com.google.gerrit.extensions.common.AccountInfo;
 import com.google.gerrit.extensions.restapi.BadRequestException;
@@ -155,9 +154,7 @@
     info.path = ownedPath.path().toString();
     info.owned = ownedPath.owned() ? true : null;
     info.owners =
-        Streams.stream(ownedPath.owners())
-            .map(GetOwnedPaths::toAccountInfo)
-            .collect(toImmutableList());
+        ownedPath.owners().stream().map(GetOwnedPaths::toAccountInfo).collect(toImmutableList());
     return info;
   }
 
diff --git a/java/com/google/gerrit/plugins/codeowners/testing/OwnedChangedFileInfoSubject.java b/java/com/google/gerrit/plugins/codeowners/testing/OwnedChangedFileInfoSubject.java
index eb6a76e..10276d6 100644
--- a/java/com/google/gerrit/plugins/codeowners/testing/OwnedChangedFileInfoSubject.java
+++ b/java/com/google/gerrit/plugins/codeowners/testing/OwnedChangedFileInfoSubject.java
@@ -63,11 +63,13 @@
   }
 
   public void hasOwnedNewPath(String expectedOwnedNewPath) {
+    @SuppressWarnings("unused")
     var unused = hasNewPathThat(expectedOwnedNewPath);
     check("ownedNewPath").that(ownedChangedFileInfo().newPath.owned).isTrue();
   }
 
   public void hasNonOwnedNewPath(String expectedNonOwnedNewPath) {
+    @SuppressWarnings("unused")
     var unused = hasNewPathThat(expectedNonOwnedNewPath);
     check("ownedNewPath").that(ownedChangedFileInfo().newPath.owned).isNull();
   }
@@ -77,11 +79,13 @@
   }
 
   public void hasOwnedOldPath(String expectedOwnedOldPath) {
+    @SuppressWarnings("unused")
     var unused = hasOldPathThat(expectedOwnedOldPath);
     check("ownedOldPath").that(ownedChangedFileInfo().oldPath.owned).isTrue();
   }
 
   public void hasNonOwnedOldPath(String expectedNonOwnedOldPath) {
+    @SuppressWarnings("unused")
     var unused = hasOldPathThat(expectedNonOwnedOldPath);
     check("ownedOldPath").that(ownedChangedFileInfo().oldPath.owned).isNull();
   }
diff --git a/web/owner-status-column.ts b/web/owner-status-column.ts
index f59212b..80871f6 100644
--- a/web/owner-status-column.ts
+++ b/web/owner-status-column.ts
@@ -61,6 +61,16 @@
   [STATUS_CODE.ERROR]: 'info',
 };
 
+const STATUS_SUMMARY = {
+  [STATUS_CODE.PENDING]: 'Pending',
+  [STATUS_CODE.MISSING]: 'Missing',
+  [STATUS_CODE.PENDING_OLD_PATH]: 'Pending Old Path',
+  [STATUS_CODE.MISSING_OLD_PATH]: 'Missing Old Path',
+  [STATUS_CODE.APPROVED]: 'Approved',
+  [STATUS_CODE.ERROR]: 'Failed',
+  [STATUS_CODE.ERROR_OLD_PATH]: 'Failed Old Path',
+};
+
 const STATUS_TOOLTIP = {
   [STATUS_CODE.PENDING]: 'Pending code owner approval',
   [STATUS_CODE.MISSING]: 'Missing code owner approval',
@@ -204,11 +214,17 @@
   }
 
   private renderStatus() {
-    const statusInfo = this.computeTooltip();
-    const statusIcon = this.computeStatusIcon();
+    const info = STATUS_TOOLTIP[this.ownerStatus!];
+    const summary = STATUS_SUMMARY[this.ownerStatus!];
+    const icon = STATUS_ICON[this.ownerStatus!];
     return html`
-      <gr-tooltip-content title=${statusInfo} has-tooltip>
-        <gr-icon class="status" icon=${statusIcon}></gr-icon>
+      <gr-tooltip-content
+        title=${info}
+        aria-label=${summary}
+        aria-description=${info}
+        has-tooltip
+      >
+        <gr-icon class="status" icon=${icon} aria-hidden="true"></gr-icon>
       </gr-tooltip-content>
     `;
   }
@@ -216,8 +232,13 @@
   private renderOwnership() {
     if (!this.isOwned()) return nothing;
     return html`
-      <gr-tooltip-content title="You are in OWNERS for this file" has-tooltip>
-        <gr-icon filled icon="policy"></gr-icon>
+      <gr-tooltip-content
+        title="You are in OWNERS for this file"
+        aria-label="owned"
+        aria-description="You are an owner of this file"
+        has-tooltip
+      >
+        <gr-icon filled icon="policy" aria-hidden="true"></gr-icon>
       </gr-tooltip-content>
     `;
   }
@@ -271,14 +292,6 @@
     );
   }
 
-  private computeStatusIcon() {
-    return STATUS_ICON[this.ownerStatus!];
-  }
-
-  private computeTooltip() {
-    return STATUS_TOOLTIP[this.ownerStatus!];
-  }
-
   private extractStatus(statusItem: FileStatus, oldPath: boolean) {
     if (statusItem === undefined) {
       return oldPath ? STATUS_CODE.ERROR_OLD_PATH : STATUS_CODE.ERROR;