Merge branch 'stable-2.14' into stable-2.15

* stable-2.14:
  Elastic{Index|ReindexIT} Remove tests for 6.2 and 6.3
  ElasticVersionTest#version6: Add missing test for V6_4
  Allow more email RFC accepted chars in username
  Make inheritance of receive.maxObjectSizeLimit optional
  Allow to inherit receive.maxObjectSizeLimit from parent project
  CreateAccount: Simplify error message when username is invalid
  Bazel: Provide toolchain with activated error prone warnings
  Use ExternalId.isValidUsername instead of ExternalId.USER_NAME_PATTERN_REGEX
  Move regular expressions for user name from Account to ExternalId
  AccountIT: Add basic tests for creating user with {in}valid username
  Revert refactoring of Account.USER_NAME_PATTERN

Change-Id: Ie96721e9135fad25672dc1fd1599cd3394f20c33
This commit is contained in:
David Pursehouse
2018-09-06 16:24:38 +09:00
32 changed files with 445 additions and 126 deletions

View File

@@ -23,7 +23,6 @@ import com.google.gerrit.client.rpc.NativeString;
import com.google.gerrit.client.rpc.RestApi;
import com.google.gerrit.client.ui.OnEditEnabler;
import com.google.gerrit.extensions.client.AccountFieldName;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
@@ -38,6 +37,12 @@ import com.google.gwtexpui.globalkey.client.NpTextBox;
import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
class UsernameField extends Composite {
// If these regular expressions are modified the same modifications should be done to the
// corresponding regular expressions in the
// com.google.gerrit.server.account.ExternalId class.
private static final String USER_NAME_PATTERN_FIRST_REGEX = "[a-zA-Z0-9]";
private static final String USER_NAME_PATTERN_REST_REGEX = "[a-zA-Z0-9.!#$%&*+=?^_`\\{|\\}~@-]";
private CopyableLabel userNameLbl;
private NpTextBox userNameTxt;
private Button setUserName;
@@ -185,9 +190,9 @@ class UsernameField extends Composite {
final TextBox box = (TextBox) event.getSource();
final String re;
if (box.getCursorPos() == 0) {
re = Account.USER_NAME_PATTERN_FIRST;
re = USER_NAME_PATTERN_FIRST_REGEX;
} else {
re = Account.USER_NAME_PATTERN_REST;
re = USER_NAME_PATTERN_REST_REGEX;
}
if (!String.valueOf(code).matches("^" + re + "$")) {
event.preventDefault();

View File

@@ -36,8 +36,6 @@ public interface AdminMessages extends Messages {
String effectiveMaxObjectSizeLimit(String effectiveMaxObjectSizeLimit);
String globalMaxObjectSizeLimit(String globalMaxObjectSizeLimit);
String noMaxObjectSizeLimit();
String pluginProjectOptionsTitle(String pluginName);

View File

@@ -6,7 +6,6 @@ deletedGroup = Deleted Group {0}
deletedReference = Reference {0} was deleted
deletedSection = Section {0} was deleted
effectiveMaxObjectSizeLimit = effective: {0} bytes
globalMaxObjectSizeLimit = The global max object size limit is set to {0}. The limit cannot be increased on project level.
noMaxObjectSizeLimit = No max object size limit is set.
pluginProjectOptionsTitle = {0} Plugin Options
pluginProjectOptionsTitle = {0} Plugin

View File

@@ -432,9 +432,8 @@ public class ProjectInfoScreen extends ProjectScreen {
if (result.maxObjectSizeLimit().value() != null) {
effectiveMaxObjectSizeLimit.setText(
AdminMessages.I.effectiveMaxObjectSizeLimit(result.maxObjectSizeLimit().value()));
if (result.maxObjectSizeLimit().inheritedValue() != null) {
effectiveMaxObjectSizeLimit.setTitle(
AdminMessages.I.globalMaxObjectSizeLimit(result.maxObjectSizeLimit().inheritedValue()));
if (result.maxObjectSizeLimit().summary() != null) {
effectiveMaxObjectSizeLimit.setTitle(result.maxObjectSizeLimit().summary());
}
} else {
effectiveMaxObjectSizeLimit.setText(AdminMessages.I.noMaxObjectSizeLimit());

View File

@@ -173,10 +173,10 @@ public class ConfigInfo extends JavaScriptObject {
public static class MaxObjectSizeLimitInfo extends JavaScriptObject {
public final native String value() /*-{ return this.value; }-*/;
public final native String inheritedValue() /*-{ return this.inherited_value; }-*/;
public final native String configuredValue() /*-{ return this.configured_value }-*/;
public final native String summary() /*-{ return this.summary; }-*/;
protected MaxObjectSizeLimitInfo() {}
}