Merge "Merge branch 'stable-2.15' into stable-2.16" into stable-2.16
This commit is contained in:
@@ -248,10 +248,16 @@ public class AccountManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!realm.allowsEdit(AccountFieldName.FULL_NAME)
|
if (!Strings.isNullOrEmpty(who.getDisplayName())
|
||||||
&& !Strings.isNullOrEmpty(who.getDisplayName())
|
|
||||||
&& !Objects.equals(user.getAccount().getFullName(), who.getDisplayName())) {
|
&& !Objects.equals(user.getAccount().getFullName(), who.getDisplayName())) {
|
||||||
accountUpdates.add(u -> u.setFullName(who.getDisplayName()));
|
accountUpdates.add(u -> u.setFullName(who.getDisplayName()));
|
||||||
|
if (realm.allowsEdit(AccountFieldName.FULL_NAME)) {
|
||||||
|
accountUpdates.add(a -> a.setFullName(who.getDisplayName()));
|
||||||
|
} else {
|
||||||
|
logger.atWarning().log(
|
||||||
|
"Not changing already set display name '%s' to '%s'",
|
||||||
|
user.getAccount().getFullName(), who.getDisplayName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!realm.allowsEdit(AccountFieldName.USER_NAME)
|
if (!realm.allowsEdit(AccountFieldName.USER_NAME)
|
||||||
|
@@ -103,9 +103,11 @@ import com.google.gerrit.reviewdb.client.Project;
|
|||||||
import com.google.gerrit.reviewdb.client.RefNames;
|
import com.google.gerrit.reviewdb.client.RefNames;
|
||||||
import com.google.gerrit.server.Sequences;
|
import com.google.gerrit.server.Sequences;
|
||||||
import com.google.gerrit.server.ServerInitiated;
|
import com.google.gerrit.server.ServerInitiated;
|
||||||
|
import com.google.gerrit.server.account.AccountManager;
|
||||||
import com.google.gerrit.server.account.AccountProperties;
|
import com.google.gerrit.server.account.AccountProperties;
|
||||||
import com.google.gerrit.server.account.AccountState;
|
import com.google.gerrit.server.account.AccountState;
|
||||||
import com.google.gerrit.server.account.AccountsUpdate;
|
import com.google.gerrit.server.account.AccountsUpdate;
|
||||||
|
import com.google.gerrit.server.account.AuthRequest;
|
||||||
import com.google.gerrit.server.account.Emails;
|
import com.google.gerrit.server.account.Emails;
|
||||||
import com.google.gerrit.server.account.ProjectWatches;
|
import com.google.gerrit.server.account.ProjectWatches;
|
||||||
import com.google.gerrit.server.account.ProjectWatches.NotifyType;
|
import com.google.gerrit.server.account.ProjectWatches.NotifyType;
|
||||||
@@ -229,6 +231,8 @@ public class AccountIT extends AbstractDaemonTest {
|
|||||||
@Inject
|
@Inject
|
||||||
private DynamicSet<AccountActivationValidationListener> accountActivationValidationListeners;
|
private DynamicSet<AccountActivationValidationListener> accountActivationValidationListeners;
|
||||||
|
|
||||||
|
@Inject private AccountManager accountManager;
|
||||||
|
|
||||||
private AccountIndexedCounter accountIndexedCounter;
|
private AccountIndexedCounter accountIndexedCounter;
|
||||||
private RegistrationHandle accountIndexEventCounterHandle;
|
private RegistrationHandle accountIndexEventCounterHandle;
|
||||||
private RefUpdateCounter refUpdateCounter;
|
private RefUpdateCounter refUpdateCounter;
|
||||||
@@ -2716,6 +2720,18 @@ public class AccountIT extends AbstractDaemonTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void updateDisplayName() throws Exception {
|
||||||
|
String name = name("test");
|
||||||
|
gApi.accounts().create(name);
|
||||||
|
AuthRequest who = AuthRequest.forUser(name);
|
||||||
|
accountManager.authenticate(who);
|
||||||
|
assertThat(gApi.accounts().id(name).get().name).isEqualTo(name);
|
||||||
|
who.setDisplayName("Something Else");
|
||||||
|
accountManager.authenticate(who);
|
||||||
|
assertThat(gApi.accounts().id(name).get().name).isEqualTo("Something Else");
|
||||||
|
}
|
||||||
|
|
||||||
private void createDraft(PushOneCommit.Result r, String path, String message) throws Exception {
|
private void createDraft(PushOneCommit.Result r, String path, String message) throws Exception {
|
||||||
DraftInput in = new DraftInput();
|
DraftInput in = new DraftInput();
|
||||||
in.path = path;
|
in.path = path;
|
||||||
|
Reference in New Issue
Block a user