Merge "Submit Requirements - Not applicable labels are not trigger votes"
diff --git a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.ts b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.ts
index 8694e11..cd484f1 100644
--- a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions.ts
@@ -974,7 +974,6 @@
codeReviewPermittedValues &&
this.account?._account_id &&
isDetailedLabelInfo(codeReviewLabel) &&
- this._getLabelStatus(codeReviewLabel) === LabelStatus.OK &&
!isOwner(this.change, this.account) &&
getApprovalInfo(codeReviewLabel, this.account)?.value !==
getVotingRange(codeReviewLabel)?.max
diff --git a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.ts b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.ts
index 2abc2bc..f7dc991 100644
--- a/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-actions/gr-change-actions_test.ts
@@ -1663,6 +1663,32 @@
assert.isNotOk(approveButton);
});
+ test('added even when label is optional', async () => {
+ element.change = {
+ ...createChangeViewChange(),
+ current_revision: 'abc1234' as CommitId,
+ labels: {
+ 'Code-Review': {
+ optional: true,
+ values: {
+ '-1': '',
+ ' 0': '',
+ '+1': '',
+ },
+ },
+ },
+ permitted_labels: {
+ 'Code-Review': ['-1', ' 0', '+1'],
+ },
+ };
+ await flush();
+ const approveButton = query(
+ element,
+ "gr-button[data-action-key='review']"
+ );
+ assert.isOk(approveButton);
+ });
+
test('approves when tapped', async () => {
const fireActionStub = sinon.stub(element, '_fireAction');
tap(queryAndAssert(element, "gr-button[data-action-key='review']"));
diff --git a/polygerrit-ui/app/embed/diff/gr-diff/gr-diff.ts b/polygerrit-ui/app/embed/diff/gr-diff/gr-diff.ts
index ab7d0ab..ea5a46b 100644
--- a/polygerrit-ui/app/embed/diff/gr-diff/gr-diff.ts
+++ b/polygerrit-ui/app/embed/diff/gr-diff/gr-diff.ts
@@ -88,8 +88,8 @@
isResponsive,
} from '../gr-diff-builder/gr-diff-builder';
-const NO_NEWLINE_BASE = 'No newline at end of base file.';
-const NO_NEWLINE_REVISION = 'No newline at end of revision file.';
+const NO_NEWLINE_LEFT = 'No newline at end of left file.';
+const NO_NEWLINE_RIGHT = 'No newline at end of right file.';
const LARGE_DIFF_THRESHOLD_LINES = 10000;
const FULL_CONTEXT = -1;
@@ -1061,10 +1061,10 @@
_computeNewlineWarning(warnLeft: boolean, warnRight: boolean) {
const messages = [];
if (warnLeft) {
- messages.push(NO_NEWLINE_BASE);
+ messages.push(NO_NEWLINE_LEFT);
}
if (warnRight) {
- messages.push(NO_NEWLINE_REVISION);
+ messages.push(NO_NEWLINE_RIGHT);
}
if (!messages.length) {
return null;
diff --git a/polygerrit-ui/app/embed/diff/gr-diff/gr-diff_test.js b/polygerrit-ui/app/embed/diff/gr-diff/gr-diff_test.js
index ef3ca39..effe4e1 100644
--- a/polygerrit-ui/app/embed/diff/gr-diff/gr-diff_test.js
+++ b/polygerrit-ui/app/embed/diff/gr-diff/gr-diff_test.js
@@ -894,8 +894,8 @@
});
suite('trailing newline warnings', () => {
- const NO_NEWLINE_BASE = 'No newline at end of base file.';
- const NO_NEWLINE_REVISION = 'No newline at end of revision file.';
+ const NO_NEWLINE_LEFT = 'No newline at end of left file.';
+ const NO_NEWLINE_RIGHT = 'No newline at end of right file.';
const getWarning = element =>
element.shadowRoot.querySelector('.newlineWarning').textContent;
@@ -910,40 +910,40 @@
element.showNewlineWarningLeft = true;
element.showNewlineWarningRight = true;
assert.include(getWarning(element),
- NO_NEWLINE_BASE + ' \u2014 ' + NO_NEWLINE_REVISION);// \u2014 - '—'
+ NO_NEWLINE_LEFT + ' \u2014 ' + NO_NEWLINE_RIGHT);// \u2014 - '—'
});
suite('showNewlineWarningLeft', () => {
test('show warning if true', () => {
element.showNewlineWarningLeft = true;
- assert.include(getWarning(element), NO_NEWLINE_BASE);
+ assert.include(getWarning(element), NO_NEWLINE_LEFT);
});
test('hide warning if false', () => {
element.showNewlineWarningLeft = false;
- assert.notInclude(getWarning(element), NO_NEWLINE_BASE);
+ assert.notInclude(getWarning(element), NO_NEWLINE_LEFT);
});
test('hide warning if undefined', () => {
element.showNewlineWarningLeft = undefined;
- assert.notInclude(getWarning(element), NO_NEWLINE_BASE);
+ assert.notInclude(getWarning(element), NO_NEWLINE_LEFT);
});
});
suite('showNewlineWarningRight', () => {
test('show warning if true', () => {
element.showNewlineWarningRight = true;
- assert.include(getWarning(element), NO_NEWLINE_REVISION);
+ assert.include(getWarning(element), NO_NEWLINE_RIGHT);
});
test('hide warning if false', () => {
element.showNewlineWarningRight = false;
- assert.notInclude(getWarning(element), NO_NEWLINE_REVISION);
+ assert.notInclude(getWarning(element), NO_NEWLINE_RIGHT);
});
test('hide warning if undefined', () => {
element.showNewlineWarningRight = undefined;
- assert.notInclude(getWarning(element), NO_NEWLINE_REVISION);
+ assert.notInclude(getWarning(element), NO_NEWLINE_RIGHT);
});
});