Merge changes I3adba5cb,I9ba44609,I7647bd97,I1759c5ba,I50f06e4e
* changes:
OnCodeOwnerApproval/OnCodeOwnerOverride: Remove wrong error log
Validation: Log exceptions that happen in dry run mode of as a warning
Add retrying to add change message on add reviewer
ChangeFiles: Limit the number of changed files that are written to trace
Consider only emails that belong to multiple active accounts as ambiguous
diff --git a/java/com/google/gerrit/plugins/codeowners/backend/CodeOwnerSubmitRule.java b/java/com/google/gerrit/plugins/codeowners/backend/CodeOwnerSubmitRule.java
index 21f411c..2dc2d37 100644
--- a/java/com/google/gerrit/plugins/codeowners/backend/CodeOwnerSubmitRule.java
+++ b/java/com/google/gerrit/plugins/codeowners/backend/CodeOwnerSubmitRule.java
@@ -73,6 +73,10 @@
try {
requireNonNull(changeData, "changeData");
+ if (changeData.change().isClosed()) {
+ return Optional.empty();
+ }
+
try (Timer0.Context ctx = codeOwnerMetrics.runCodeOwnerSubmitRule.start()) {
logger.atFine().log(
"run code owner submit rule (project = %s, change = %d)",
diff --git a/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerSubmitRuleTest.java b/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerSubmitRuleTest.java
index b495bd4..1772809 100644
--- a/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerSubmitRuleTest.java
+++ b/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerSubmitRuleTest.java
@@ -20,6 +20,7 @@
import static org.mockito.Mockito.when;
import com.google.gerrit.acceptance.testsuite.request.RequestScopeOperations;
+import com.google.gerrit.entities.Change;
import com.google.gerrit.plugins.codeowners.acceptance.AbstractCodeOwnersTest;
import com.google.gerrit.plugins.codeowners.acceptance.testsuite.CodeOwnerConfigOperations;
import com.google.gerrit.plugins.codeowners.testing.SubmitRecordSubject;
@@ -50,6 +51,34 @@
}
@Test
+ public void emptyIfChangeIdClosed() throws Exception {
+ codeOwnerConfigOperations
+ .newCodeOwnerConfig()
+ .project(project)
+ .branch("master")
+ .folderPath("/foo/")
+ .addCodeOwnerEmail(user.email())
+ .create();
+
+ String path = "foo/bar.baz";
+ Change change = createChange("Change Adding A File", path, "file content").getChange().change();
+ String changeId = change.getKey().get();
+
+ // Add a Code-Review+1 from a code owner (by default this counts as code owner approval).
+ requestScopeOperations.setApiUser(user.id());
+ recommend(changeId);
+
+ // Approve and submit.
+ requestScopeOperations.setApiUser(admin.id());
+ approve(changeId);
+ gApi.changes().id(changeId).current().submit();
+
+ // Run the code owners submit rule on the closed change.
+ ChangeData changeData = changeDataFactory.create(project, change.getId());
+ assertThat(codeOwnerSubmitRule.evaluate(changeData)).isEmpty();
+ }
+
+ @Test
public void notReady() throws Exception {
ChangeData changeData = createChange().getChange();
SubmitRecordSubject submitRecordSubject =
diff --git a/ui/suggest-owners.js b/ui/suggest-owners.js
index b913cb0..2395476 100644
--- a/ui/suggest-owners.js
+++ b/ui/suggest-owners.js
@@ -181,13 +181,16 @@
height: 16px;
}
gr-account-label {
- background-color: var(--background-color-tertiary);
display: inline-block;
padding: var(--spacing-xs) var(--spacing-m);
user-select: none;
border: 1px solid transparent;
--label-border-radius: 8px;
- --account-max-length: 100px;
+ /* account-max-length defines the max text width inside account-label.
+ With 60px the gr-account-label always has width <= 100px and 5 labels
+ are always fit in a single row */
+ --account-max-length: 60px;
+ border: 1px solid var(--border-color);
}
gr-account-label:focus {
outline: none;