Merge branch 'stable-3.1'

* stable-3.1:
  CommentsIT#postCommentsUnreachableData: Remove unnecessary setApiUser call
  ChangeDraftUpdate: Remove unused local variable
  Fix deletion of draft comment refs
  Upgrade testcontainers to 1.12.4
  Fix loading font-roboto-local in the ui
  ExternalIdCacheLoader: suppress warning if cache is not persisted.
  ChangeEmail: add project to email headers
  OutgoingEmail: use consistently va.smtpRcptTo reference
  NotificationEmail: use MailHeader for 'Gerrit-Branch' footer name
  Update git submodules
  Update git submodules
  Update git submodules
  Fix "TypeError: groups is not iterable" in _disableAgreements
  Fix typos: Aggreements -> Agreements
  Upgrade gitiles-servlet and blame-cache to 0.3-7

Change-Id: I3640f489c25eebaa024fe8b6992adc5956d71547
This commit is contained in:
David Pursehouse 2019-12-03 12:34:45 +09:00
commit d772e2c859
10 changed files with 31 additions and 24 deletions

View File

@ -748,7 +748,7 @@ maven_jar(
sha1 = "f7be08ec23c21485b9b5a1cf1654c2ec8c58168d",
)
GITILES_VERS = "0.3-6"
GITILES_VERS = "0.3-7"
GITILES_REPO = GERRIT
@ -757,14 +757,14 @@ maven_jar(
artifact = "com.google.gitiles:blame-cache:" + GITILES_VERS,
attach_source = False,
repository = GITILES_REPO,
sha1 = "bd1ec86570b8a6e4b68c5af6311c8cd10aa3f295",
sha1 = "af6212a62363906c63d367f8276ae1645f83bf93",
)
maven_jar(
name = "gitiles-servlet",
artifact = "com.google.gitiles:gitiles-servlet:" + GITILES_VERS,
repository = GITILES_REPO,
sha1 = "98bf06ca9abc871beb3d6c01e6f053243d4e911a",
sha1 = "6a53f722f8572a2f1bcb7d86e5692168844bab76",
)
# prettify must match the version used in Gitiles

View File

@ -180,6 +180,7 @@ public abstract class ChangeEmail extends NotificationEmail {
setChangeSubjectHeader();
setHeader(MailHeader.CHANGE_ID.fieldName(), "" + change.getKey().get());
setHeader(MailHeader.CHANGE_NUMBER.fieldName(), "" + change.getChangeId());
setHeader(MailHeader.PROJECT.fieldName(), "" + change.getProject());
setChangeUrlHeader();
setCommitIdHeader();

View File

@ -122,7 +122,7 @@ public abstract class NotificationEmail extends OutgoingEmail {
soyContext.put("branch", branchData);
footers.add(MailHeader.PROJECT.withDelimiter() + branch.project().get());
footers.add("Gerrit-Branch: " + branch.shortName());
footers.add(MailHeader.BRANCH.withDelimiter() + branch.shortName());
}
@VisibleForTesting

View File

@ -211,12 +211,12 @@ public abstract class OutgoingEmail {
}
}
Set<Address> intersection = Sets.intersection(smtpRcptTo, smtpRcptToPlaintextOnly);
Set<Address> intersection = Sets.intersection(va.smtpRcptTo, smtpRcptToPlaintextOnly);
if (!intersection.isEmpty()) {
logger.atSevere().log("Email '%s' will be sent twice to %s", messageClass, intersection);
}
if (!smtpRcptTo.isEmpty()) {
if (!va.smtpRcptTo.isEmpty()) {
// Send multipart message
logger.atFine().log(
"Sending multipart '%s' from %s to %s",

View File

@ -319,8 +319,6 @@ public class CommentsIT extends AbstractDaemonTest {
@Test
public void postCommentsUnreachableData() throws Exception {
requestScopeOperations.setApiUser(admin.id());
String file = "file";
PushOneCommit push =
pushFactory.create(admin.newIdent(), testRepo, "first subject", file, "l1\nl2\n");

View File

@ -80,10 +80,10 @@ limitations under the License.
data-name$="[[item.name]]"
data-url$="[[item.url]]"
on-click="_handleShowAgreement"
disabled$="[[_disableAggreements(item, _groups, _signedAgreements)]]">
disabled$="[[_disableAgreements(item, _groups, _signedAgreements)]]">
<label id="claNewAgreementsLabel">[[item.name]]</label>
</span>
<div class$="alreadySubmittedText [[_hideAggreements(item, _groups, _signedAgreements)]]">
<div class$="alreadySubmittedText [[_hideAgreements(item, _groups, _signedAgreements)]]">
Agreement already submitted.
</div>
<div class="agreementsUrl">

View File

@ -117,7 +117,8 @@
return agreements ? 'show' : '';
}
_disableAggreements(item, groups, signedAgreements) {
_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) ||
@ -128,8 +129,8 @@
return false;
}
_hideAggreements(item, groups, signedAgreements) {
return this._disableAggreements(item, groups, signedAgreements) ?
_hideAgreements(item, groups, signedAgreements) {
return this._disableAgreements(item, groups, signedAgreements) ?
'' : 'hide';
}
@ -141,6 +142,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;

View File

@ -142,28 +142,31 @@ 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));
// Make sure the undefined check works
assert.isFalse(
element._disableAgreements(auth, undefined, 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', () => {

View File

@ -89,6 +89,8 @@ def polygerrit_bundle(name, srcs, outs, app):
# we extract from the zip, but depend on the component for license checking.
"@webcomponentsjs//:zipfile",
"//lib/js:webcomponentsjs",
"@font-roboto-local//:zipfile",
"//lib/js:font-roboto-local",
],
outs = outs,
cmd = " && ".join([
@ -100,6 +102,7 @@ def polygerrit_bundle(name, srcs, outs, app):
"for f in $(locations " + name + "_theme_sources); do cp $$f $$TMP/polygerrit_ui/styles/themes; done",
"for f in $(locations //lib/js:highlightjs_files); do cp $$f $$TMP/polygerrit_ui/bower_components/highlightjs/ ; done",
"unzip -qd $$TMP/polygerrit_ui/bower_components $(location @webcomponentsjs//:zipfile) webcomponentsjs/webcomponents-lite.js",
"unzip -qd $$TMP/polygerrit_ui/bower_components $(location @font-roboto-local//:zipfile) font-roboto-local/fonts/\*/\*.ttf",
"cd $$TMP",
"find . -exec touch -t 198001010000 '{}' ';'",
"zip -qr $$ROOT/$@ *",

View File

@ -170,18 +170,18 @@ def declare_nongoogle_deps():
sha1 = "3e83394258ae2089be7219b971ec21a8288528ad",
)
TESTCONTAINERS_VERSION = "1.12.3"
TESTCONTAINERS_VERSION = "1.12.4"
maven_jar(
name = "testcontainers",
artifact = "org.testcontainers:testcontainers:" + TESTCONTAINERS_VERSION,
sha1 = "e424a4549640e120acceac641ac909fcda58bf62",
sha1 = "456b6facac12c4b67130d9056a43c011679e9f0c",
)
maven_jar(
name = "testcontainers-elasticsearch",
artifact = "org.testcontainers:elasticsearch:" + TESTCONTAINERS_VERSION,
sha1 = "c0796de5032070b8768ce78c78949b48f13c30db",
sha1 = "9e210c277a35a95a76d03a79e2812575bd07391c",
)
maven_jar(