From 8083ea4fc653e665ec2ebfe0013e8234c1d3748e Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Mon, 2 Dec 2019 08:16:40 +0900 Subject: [PATCH 1/4] Fix typos: Aggreements -> Agreements Change-Id: I49cb451cbc509f673ac5d596d14ca8deb4a06d30 --- .../settings/gr-cla-view/gr-cla-view.html | 4 ++-- .../elements/settings/gr-cla-view/gr-cla-view.js | 6 +++--- .../settings/gr-cla-view/gr-cla-view_test.html | 16 ++++++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.html b/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.html index d5f1dc3a8a..4a939e6433 100644 --- a/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.html +++ b/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.html @@ -77,10 +77,10 @@ limitations under the License. data-name$="[[item.name]]" data-url$="[[item.url]]" on-tap="_handleShowAgreement" - disabled$="[[_disableAggreements(item, _groups, _signedAgreements)]]"> + disabled$="[[_disableAgreements(item, _groups, _signedAgreements)]]"> -
+
Agreement already submitted.
diff --git a/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.js b/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.js index c7713322fa..c9b404d2ca 100644 --- a/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.js +++ b/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.js @@ -107,7 +107,7 @@ return agreements ? 'show' : ''; }, - _disableAggreements(item, groups, signedAgreements) { + _disableAgreements(item, groups, signedAgreements) { for (const group of groups) { if ((item && item.auto_verify_group && item.auto_verify_group.id === group.id) || @@ -118,8 +118,8 @@ return false; }, - _hideAggreements(item, groups, signedAgreements) { - return this._disableAggreements(item, groups, signedAgreements) ? + _hideAgreements(item, groups, signedAgreements) { + return this._disableAgreements(item, groups, signedAgreements) ? '' : 'hide'; }, diff --git a/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view_test.html b/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view_test.html index 2304d15205..2bc0b10d65 100644 --- a/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view_test.html +++ b/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view_test.html @@ -140,28 +140,28 @@ limitations under the License. 'none'); }); - test('_disableAggreements', () => { + test('_disableAgreements', () => { // In the auto verify group and have not yet signed agreement assert.isTrue( - element._disableAggreements(auth, groups, signedAgreements)); + element._disableAgreements(auth, groups, signedAgreements)); // Not in the auto verify group and have not yet signed agreement assert.isFalse( - element._disableAggreements(auth2, groups, signedAgreements)); + element._disableAgreements(auth2, groups, signedAgreements)); // Not in the auto verify group, have signed agreement assert.isTrue( - element._disableAggreements(auth3, groups, signedAgreements)); + element._disableAgreements(auth3, groups, signedAgreements)); }); - test('_hideAggreements', () => { + test('_hideAgreements', () => { // Not in the auto verify group and have not yet signed agreement assert.equal( - element._hideAggreements(auth, groups, signedAgreements), ''); + element._hideAgreements(auth, groups, signedAgreements), ''); // In the auto verify group assert.equal( - element._hideAggreements(auth2, groups, signedAgreements), 'hide'); + element._hideAgreements(auth2, groups, signedAgreements), 'hide'); // Not in the auto verify group, have signed agreement assert.equal( - element._hideAggreements(auth3, groups, signedAgreements), ''); + element._hideAgreements(auth3, groups, signedAgreements), ''); }); test('_disableAgreementsText', () => { From fa1e1f1a5d75eac65eb7a398c0ed6cba60648e17 Mon Sep 17 00:00:00 2001 From: Paladox none Date: Sat, 30 Nov 2019 23:46:02 +0000 Subject: [PATCH 2/4] Fix "TypeError: groups is not iterable" in _disableAgreements This fixes an issue by adding a undefined check to _disableAgreements in addition to that we also add the check to _computeHideAgreementClass too. Bug: Issue 12020 Change-Id: Icf444aa315d24b34b5bf1cd62173ae62f6b84931 --- polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.js | 2 ++ .../app/elements/settings/gr-cla-view/gr-cla-view_test.html | 3 +++ 2 files changed, 5 insertions(+) diff --git a/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.js b/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.js index c9b404d2ca..493b1794cf 100644 --- a/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.js +++ b/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view.js @@ -108,6 +108,7 @@ }, _disableAgreements(item, groups, signedAgreements) { + if (!groups) return false; for (const group of groups) { if ((item && item.auto_verify_group && item.auto_verify_group.id === group.id) || @@ -131,6 +132,7 @@ // if specified it returns 'hideAgreementsTextBox' which // then hides the text box and submit button. _computeHideAgreementClass(name, config) { + if (!config) return ''; for (const key in config) { if (!config.hasOwnProperty(key)) { continue; } for (const prop in config[key]) { diff --git a/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view_test.html b/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view_test.html index 2bc0b10d65..aec52cb8f2 100644 --- a/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view_test.html +++ b/polygerrit-ui/app/elements/settings/gr-cla-view/gr-cla-view_test.html @@ -150,6 +150,9 @@ limitations under the License. // Not in the auto verify group, have signed agreement assert.isTrue( element._disableAgreements(auth3, groups, signedAgreements)); + // Make sure the undefined check works + assert.isFalse( + element._disableAgreements(auth, undefined, signedAgreements)); }); test('_hideAgreements', () => { From a41d4db58abfec96ccc4837a34a7cf15cc0d9dda Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Mon, 2 Dec 2019 16:12:49 +0900 Subject: [PATCH 3/4] Update git submodules * Update plugins/hooks from branch 'stable-2.16' to 57c8e6261016e1cc233ea41f19fa5bdf187df8a7 - Fix and clarify documentation of ref-update and commit-received hooks - Clarify behavior of ref-update when multiple commits are pushed, i.e. that it is only called once for the entire ref update. - Fix the documentation of commit-received which states that it is called for changes pushed for review. In fact it is also called for direct pushes, but unlike ref-update it is called once for each commit. Change-Id: Ie3e2dcab37eeb5d0ed06e05322e72d3fc73925fd - Correct documentation of ref-update hook regarding output The output of the hook is only returned when the update is rejected, not regardless of the return code as stated in the doc. Change-Id: I93483f44e31e7055c302c0758084de868d1c4f93 --- plugins/hooks | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hooks b/plugins/hooks index e9127800c4..57c8e62610 160000 --- a/plugins/hooks +++ b/plugins/hooks @@ -1 +1 @@ -Subproject commit e9127800c4efe8ad9601c7b1152783cd12a55bc2 +Subproject commit 57c8e6261016e1cc233ea41f19fa5bdf187df8a7 From be294ac2e18629a4827f6c229b184cdcab97495a Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Mon, 2 Dec 2019 17:04:52 +0900 Subject: [PATCH 4/4] Update git submodules * Update plugins/hooks from branch 'stable-3.0' to 072ee210f38f4c1bdc55330e88dc844b4daad6ca - Merge branch 'stable-2.16' into stable-3.0 * stable-2.16: Fix and clarify documentation of ref-update and commit-received hooks Correct documentation of ref-update hook regarding output Change-Id: Ia446c95e1f6ca12e1cbd198d3a7e4f6a16b09fc6 - Fix and clarify documentation of ref-update and commit-received hooks - Clarify behavior of ref-update when multiple commits are pushed, i.e. that it is only called once for the entire ref update. - Fix the documentation of commit-received which states that it is called for changes pushed for review. In fact it is also called for direct pushes, but unlike ref-update it is called once for each commit. Change-Id: Ie3e2dcab37eeb5d0ed06e05322e72d3fc73925fd - Correct documentation of ref-update hook regarding output The output of the hook is only returned when the update is rejected, not regardless of the return code as stated in the doc. Change-Id: I93483f44e31e7055c302c0758084de868d1c4f93 --- plugins/hooks | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hooks b/plugins/hooks index d0976393a5..072ee210f3 160000 --- a/plugins/hooks +++ b/plugins/hooks @@ -1 +1 @@ -Subproject commit d0976393a5d8eea9384631bfa189b1f6518e9128 +Subproject commit 072ee210f38f4c1bdc55330e88dc844b4daad6ca