Merge "UI: Replace iron-autogrow-textarea with gr-autogrow-textarea"
diff --git a/java/com/google/gerrit/server/restapi/change/ApplyProvidedFix.java b/java/com/google/gerrit/server/restapi/change/ApplyProvidedFix.java
index a8e46b3..6c05308 100644
--- a/java/com/google/gerrit/server/restapi/change/ApplyProvidedFix.java
+++ b/java/com/google/gerrit/server/restapi/change/ApplyProvidedFix.java
@@ -26,6 +26,7 @@
import com.google.gerrit.extensions.common.EditInfo;
import com.google.gerrit.extensions.restapi.AuthException;
import com.google.gerrit.extensions.restapi.BadRequestException;
+import com.google.gerrit.extensions.restapi.MergeConflictException;
import com.google.gerrit.extensions.restapi.ResourceConflictException;
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
import com.google.gerrit.extensions.restapi.Response;
@@ -125,9 +126,17 @@
CommitModification commitModification =
getCommitModification(
repository, projectState, originPatchSetForFix, targetPatchSet, fixReplacements);
- ChangeEdit changeEdit =
- changeEditModifier.combineWithModifiedPatchSetTree(
- repository, changeNotes, targetPatchSet, commitModification);
+ ChangeEdit changeEdit;
+ try {
+ changeEdit =
+ changeEditModifier.combineWithModifiedPatchSetTree(
+ repository, changeNotes, targetPatchSet, commitModification);
+ } catch (MergeConflictException e) {
+ throw new ResourceConflictException(
+ "The suggested fix could not be applied because it conflicts with the existing change"
+ + " edit. Please apply the fix locally.",
+ e);
+ }
return Response.ok(changeEditJson.toEditInfo(changeEdit, false));
} catch (InvalidChangeOperationException e) {
diff --git a/package.json b/package.json
index 399ed3d..f08bb42 100644
--- a/package.json
+++ b/package.json
@@ -17,6 +17,7 @@
"@web/dev-server-esbuild": "^1.0.4",
"eslint": "^9.26.0",
"eslint-config-google": "^0.14.0",
+ "eslint-plugin-es-x": "8.0.0",
"eslint-plugin-html": "^8.1.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsdoc": "^50.6.11",
@@ -71,4 +72,4 @@
},
"author": "",
"license": "Apache-2.0"
-}
\ No newline at end of file
+}
diff --git a/polygerrit-ui/app/BUILD b/polygerrit-ui/app/BUILD
index bddda2c..d94c10c 100644
--- a/polygerrit-ui/app/BUILD
+++ b/polygerrit-ui/app/BUILD
@@ -169,6 +169,7 @@
"@npm//eslint-plugin-n",
"@npm//eslint-plugin-prettier",
"@npm//eslint-plugin-regex",
+ "@npm//eslint-plugin-es-x",
"@npm//gts",
],
)
diff --git a/polygerrit-ui/app/eslint.config.js b/polygerrit-ui/app/eslint.config.js
index 908980a..be1ad81 100644
--- a/polygerrit-ui/app/eslint.config.js
+++ b/polygerrit-ui/app/eslint.config.js
@@ -432,6 +432,16 @@
'lit/quoted-expressions': ['error', 'never'],
},
},
+ {
+ files: ['**/*.ts'],
+ rules: {
+ 'es-x/no-array-prototype-at': 'error',
+ 'es-x/no-object-hasown': 'error',
+ 'es-x/no-regexp-d-flag': 'error',
+ 'es-x/no-string-prototype-at': 'error',
+ 'es-x/no-error-cause': 'error',
+ },
+ },
],
plugins: [
'html',
@@ -440,6 +450,7 @@
'lit',
'prettier',
'regex',
+ 'es-x',
],
settings: {
'html/report-bad-indent': 'error',
diff --git a/polygerrit-ui/app/utils/label-util.ts b/polygerrit-ui/app/utils/label-util.ts
index 8a9db6b..e6228aa 100644
--- a/polygerrit-ui/app/utils/label-util.ts
+++ b/polygerrit-ui/app/utils/label-util.ts
@@ -287,7 +287,11 @@
extractLabelsFrom(requirement.submittability_expression_result.expression)
);
}
- if (requirement.override_expression_result && type !== 'onlySubmittability') {
+ if (
+ requirement.override_expression_result &&
+ type !== 'onlySubmittability' &&
+ requirement.override_expression_result.fulfilled
+ ) {
labels = labels.concat(
extractLabelsFrom(requirement.override_expression_result.expression)
);
diff --git a/polygerrit-ui/app/utils/label-util_test.ts b/polygerrit-ui/app/utils/label-util_test.ts
index 8911249..7e7fc38 100644
--- a/polygerrit-ui/app/utils/label-util_test.ts
+++ b/polygerrit-ui/app/utils/label-util_test.ts
@@ -528,6 +528,17 @@
const labels = extractAssociatedLabels(submitRequirement);
assert.deepEqual(labels, ['Verified', 'Build-cop-override']);
});
+ test('overridden label when override expression is unfulfilled', () => {
+ const submitRequirement = {
+ ...createSubmitRequirementResultInfo(),
+ override_expression_result: {
+ ...createSubmitRequirementExpressionInfo('label:Build-cop-override'),
+ fulfilled: false,
+ },
+ };
+ const labels = extractAssociatedLabels(submitRequirement);
+ assert.deepEqual(labels, ['Verified']);
+ });
});
suite('extractLabelsWithCountFrom', () => {
diff --git a/yarn.lock b/yarn.lock
index 8eba30c..4dacdf7 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1856,6 +1856,15 @@
dependencies:
debug "^3.2.7"
+eslint-plugin-es-x@8.0.0:
+ version "8.0.0"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-es-x/-/eslint-plugin-es-x-8.0.0.tgz#66835093aae1cdf7e1639a17036ca179369ac456"
+ integrity sha512-kPIagK5FxZBDwVxZXCsxmZUjU2aYGeTs4/wfAauI2FAThsbeLgred5b+6S0x7Hhx04GPzrB4j0h60bnsyLpzEA==
+ dependencies:
+ "@eslint-community/eslint-utils" "^4.1.2"
+ "@eslint-community/regexpp" "^4.11.0"
+ eslint-compat-utils "^0.5.1"
+
eslint-plugin-es-x@^7.8.0:
version "7.8.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-es-x/-/eslint-plugin-es-x-7.8.0.tgz#a207aa08da37a7923f2a9599e6d3eb73f3f92b74"