Merge branch 'stable-2.9'

* stable-2.9:
  Copy label approvals when cherry-picking change to same branch
  Remove unused "Change Username" string constant
  Require the user to confirm setting the username

Change-Id: I650481770d95f06680499947834f01beaca08cff
This commit is contained in:
David Pursehouse 2014-05-13 15:55:19 +09:00
commit 7725916c7e
4 changed files with 22 additions and 4 deletions

View File

@ -67,7 +67,8 @@ public interface AccountConstants extends Constants {
String userName();
String password();
String buttonSetUserName();
String buttonChangeUserName();
String confirmSetUserNameTitle();
String confirmSetUserName();
String buttonClearPassword();
String buttonGeneratePassword();
String linkObtainPassword();

View File

@ -49,7 +49,8 @@ buttonAddSshKey = Add
userName = Username
password = Password
buttonSetUserName = Select Username
buttonChangeUserName = Change Username
confirmSetUserNameTitle = Confirm Setting the Username
confirmSetUserName Setting the Username is permanent. Are you sure?
buttonClearPassword = Clear Password
buttonGeneratePassword = Generate Password
linkObtainPassword = Obtain Password

View File

@ -14,6 +14,8 @@
package com.google.gerrit.client.account;
import com.google.gerrit.client.ConfirmationCallback;
import com.google.gerrit.client.ConfirmationDialog;
import com.google.gerrit.client.ErrorDialog;
import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.rpc.GerritCallback;
@ -31,6 +33,7 @@ import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwtexpui.clippy.client.CopyableLabel;
import com.google.gwtexpui.globalkey.client.NpTextBox;
import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
import com.google.gwtjsonrpc.common.VoidResult;
class UsernameField extends Composite {
@ -59,7 +62,7 @@ class UsernameField extends Composite {
@Override
public void onKeyPress(KeyPressEvent event) {
if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
doSetUserName();
confirmSetUserName();
}
}
});
@ -70,7 +73,7 @@ class UsernameField extends Composite {
setUserName.addClickHandler(new ClickHandler() {
@Override
public void onClick(final ClickEvent event) {
doSetUserName();
confirmSetUserName();
}
});
new OnEditEnabler(setUserName, userNameTxt);
@ -86,6 +89,18 @@ class UsernameField extends Composite {
return Gerrit.getConfig().canEdit(Account.FieldName.USER_NAME);
}
private void confirmSetUserName() {
new ConfirmationDialog(
Util.C.confirmSetUserNameTitle(),
new SafeHtmlBuilder().append(Util.C.confirmSetUserName()),
new ConfirmationCallback() {
@Override
public void onOk() {
doSetUserName();
}
}).center();
}
private void doSetUserName() {
if (!canEditUserName()) {
return;

View File

@ -206,6 +206,7 @@ public class CherryPickChange {
.setMessage("Uploaded patch set " + newPatchSetId.get() + ".")
.setDraft(current.isDraft())
.setUploader(uploader.getAccountId())
.setCopyLabels(true)
.insert();
return change.getId();
}