Merge "Fix support to use "Default Base For Merges" preference" into stable-2.16
diff --git a/.mailmap b/.mailmap
index c863847..b5c119c 100644
--- a/.mailmap
+++ b/.mailmap
@@ -6,6 +6,7 @@
Alex Ryazantsev <alex.ryazantsev@gmail.com> alex.ryazantsev <alex.ryazantsev@gmail.com>
Andrew Bonventre <andybons@chromium.org> <andybons@google.com>
Becky Siegel <beckysiegel@google.com> beckysiegel <beckysiegel@google.com>
+Ben Rohlfs <brohlfs@google.com> brohlfs <brohlfs@google.com>
Brad Larson <bklarson@gmail.com> <brad.larson@garmin.com>
Bruce Zu <bruce.zu.run10@gmail.com> <bruce.zu@sonyericsson.com>
Bruce Zu <bruce.zu.run10@gmail.com> <bruce.zu@sonymobile.com>
diff --git a/Documentation/user-search.txt b/Documentation/user-search.txt
index 7c904f5..48d331b 100644
--- a/Documentation/user-search.txt
+++ b/Documentation/user-search.txt
@@ -216,7 +216,8 @@
[[hashtag]]
hashtag:'HASHTAG'::
+
-Changes whose link:intro-user.html#hashtags[hashtag] matches 'HASHTAG' exactly.
+Changes whose link:intro-user.html#hashtags[hashtag] matches 'HASHTAG'.
+The match is case-insensitive.
[[ref]]
ref:'REF'::
diff --git a/WORKSPACE b/WORKSPACE
index aa4e9f5..47ead15d 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -48,11 +48,11 @@
# Golang support for PolyGerrit local dev server.
http_archive(
name = "io_bazel_rules_go",
- sha256 = "ee5fe78fe417c685ecb77a0a725dc9f6040ae5beb44a0ba4ddb55453aad23a8a",
- url = "https://github.com/bazelbuild/rules_go/releases/download/0.16.0/rules_go-0.16.0.tar.gz",
+ sha256 = "6776d68ebb897625dead17ae510eac3d5f6342367327875210df44dbe2aeeb19",
+ url = "https://github.com/bazelbuild/rules_go/releases/download/0.17.1/rules_go-0.17.1.tar.gz",
)
-load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies")
+load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
go_rules_dependencies()
@@ -60,8 +60,8 @@
http_archive(
name = "bazel_gazelle",
- sha256 = "c0a5739d12c6d05b6c1ad56f2200cb0b57c5a70e03ebd2f7b87ce88cabf09c7b",
- urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.14.0/bazel-gazelle-0.14.0.tar.gz"],
+ sha256 = "3c681998538231a2d24d0c07ed5a7658cb72bfb5fd4bf9911157c0e9ac6a2687",
+ urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.17.0/bazel-gazelle-0.17.0.tar.gz"],
)
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/SearchSuggestOracle.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/SearchSuggestOracle.java
index cb3e9f0..e74ed71 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/SearchSuggestOracle.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/SearchSuggestOracle.java
@@ -138,6 +138,7 @@
suggestions.add("is:ignored");
suggestions.add("is:wip");
suggestions.add("is:assigned");
+ suggestions.add("is:submittable");
suggestions.add("status:");
suggestions.add("status:open");
diff --git a/java/com/google/gerrit/acceptance/LogThreshold.java b/java/com/google/gerrit/acceptance/LogThreshold.java
index da1fcc5..36831f3 100644
--- a/java/com/google/gerrit/acceptance/LogThreshold.java
+++ b/java/com/google/gerrit/acceptance/LogThreshold.java
@@ -17,11 +17,13 @@
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@Target({TYPE, METHOD})
@Retention(RUNTIME)
+@Inherited
public @interface LogThreshold {
String level() default "DEBUG";
}
diff --git a/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar.js b/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar.js
index a81526c..91c16c3 100644
--- a/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar.js
+++ b/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar.js
@@ -60,6 +60,7 @@
'is:reviewed',
'is:reviewer',
'is:starred',
+ 'is:submittable',
'is:watched',
'is:wip',
'label:',
diff --git a/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator.js b/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator.js
index 70eed78..fe82f2b 100644
--- a/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator.js
+++ b/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator.js
@@ -112,7 +112,7 @@
},
_initModule({moduleName, plugin, type, domHook}) {
- if (this._initializedPlugins.get(plugin.name)) {
+ if (this._initializedPlugins.get(plugin.getPluginName())) {
return;
}
let initPromise;
@@ -128,7 +128,7 @@
console.warn('Unable to initialize module' +
`${moduleName} from ${plugin.getPluginName()}`);
}
- this._initializedPlugins.set(plugin.name, true);
+ this._initializedPlugins.set(plugin.getPluginName(), true);
initPromise.then(el => {
domHook.handleInstanceAttached(el);
this._domHooks.set(el, domHook);
diff --git a/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar.js b/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar.js
index f32e940b..bf56382 100644
--- a/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar.js
+++ b/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar.js
@@ -41,25 +41,30 @@
attached() {
Promise.all([
- this.$.restAPI.getConfig(),
+ this._getConfig(),
Gerrit.awaitPluginsLoaded(),
]).then(([cfg]) => {
this._hasAvatars = !!(cfg && cfg.plugin && cfg.plugin.has_avatars);
- if (this._hasAvatars && this.account) {
- // src needs to be set if avatar becomes visible
- this._updateAvatarURL();
- } else {
- this.hidden = true;
- }
+
+ this._updateAvatarURL();
});
},
+ _getConfig() {
+ return this.$.restAPI.getConfig();
+ },
+
_accountChanged(account) {
this._updateAvatarURL();
},
_updateAvatarURL() {
- if (this.hidden || !this._hasAvatars) { return; }
+ if (!this._hasAvatars || !this.account) {
+ this.hidden = true;
+ return;
+ }
+ this.hidden = false;
+
const url = this._buildAvatarURL(this.account);
if (url) {
this.style.backgroundImage = 'url("' + url + '")';
diff --git a/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar_test.html b/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar_test.html
index f137c7f..5ce17c0 100644
--- a/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar_test.html
+++ b/polygerrit-ui/app/elements/shared/gr-avatar/gr-avatar_test.html
@@ -35,14 +35,17 @@
<script>
suite('gr-avatar tests', () => {
let element;
+ let sandbox;
setup(() => {
- stub('gr-rest-api-interface', {
- getConfig() { return Promise.resolve({plugin: {has_avatars: true}}); },
- });
+ sandbox = sinon.sandbox.create();
element = fixture('basic');
});
+ teardown(() => {
+ sandbox.restore();
+ });
+
test('methods', () => {
assert.equal(element._buildAvatarURL(
{
@@ -94,22 +97,32 @@
],
}),
'/accounts/123/avatar?s=16');
+ assert.equal(element._buildAvatarURL(undefined), '');
});
test('dom for existing account', () => {
assert.isFalse(element.hasAttribute('hidden'));
+
+ sandbox.stub(element, '_getConfig', () => {
+ return Promise.resolve({plugin: {has_avatars: true}});
+ });
+
element.imageSize = 64;
element.account = {
_account_id: 123,
};
+
assert.strictEqual(element.style.backgroundImage, '');
+
// Emulate plugins loaded.
Gerrit._setPluginsPending([]);
- return Promise.all([
+
+ Promise.all([
element.$.restAPI.getConfig(),
Gerrit.awaitPluginsLoaded(),
]).then(() => {
assert.isFalse(element.hasAttribute('hidden'));
+
assert.isTrue(
element.style.backgroundImage.includes('/accounts/123/avatar?s=64'));
});
@@ -117,10 +130,57 @@
test('dom for non available account', () => {
assert.isFalse(element.hasAttribute('hidden'));
- element.account = null;
- assert.isFalse(element.hasAttribute('hidden'));
+
+ sandbox.stub(element, '_getConfig', () => {
+ return Promise.resolve({plugin: {has_avatars: true}});
+ });
+
// Emulate plugins loaded.
Gerrit._setPluginsPending([]);
+
+ return Promise.all([
+ element.$.restAPI.getConfig(),
+ Gerrit.awaitPluginsLoaded(),
+ ]).then(() => {
+ assert.isTrue(element.hasAttribute('hidden'));
+
+ assert.strictEqual(element.style.backgroundImage, '');
+ });
+ });
+
+ test('avatar config not set and account not set', () => {
+ assert.isFalse(element.hasAttribute('hidden'));
+
+ sandbox.stub(element, '_getConfig', () => {
+ return Promise.resolve({});
+ });
+
+ // Emulate plugins loaded.
+ Gerrit._setPluginsPending([]);
+
+ return Promise.all([
+ element.$.restAPI.getConfig(),
+ Gerrit.awaitPluginsLoaded(),
+ ]).then(() => {
+ assert.isTrue(element.hasAttribute('hidden'));
+ });
+ });
+
+ test('avatar config not set and account set', () => {
+ assert.isFalse(element.hasAttribute('hidden'));
+
+ sandbox.stub(element, '_getConfig', () => {
+ return Promise.resolve({});
+ });
+
+ element.imageSize = 64;
+ element.account = {
+ _account_id: 123,
+ };
+
+ // Emulate plugins loaded.
+ Gerrit._setPluginsPending([]);
+
return Promise.all([
element.$.restAPI.getConfig(),
Gerrit.awaitPluginsLoaded(),