mirror of
https://github.com/google/nomulus.git
synced 2025-07-22 18:55:58 +02:00
Don't override existing registrar email address when setting referral email (#2300)
The fallback should only apply on creates, not on updates, otherwise it can
override an existing value for the email address when only the referral email
should be what's updated.
This fixes a bug introduced back in commit in 0ead4f8d9d
.
BUG= http://b/322026165
This commit is contained in:
parent
829be0777b
commit
5e36cf30c3
2 changed files with 7 additions and 5 deletions
|
@ -292,8 +292,8 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand {
|
|||
}
|
||||
if (!isNullOrEmpty(email)) {
|
||||
builder.setEmailAddress(email);
|
||||
} else if (!isNullOrEmpty(
|
||||
icannReferralEmail)) { // fall back to ICANN referral email if present
|
||||
} else if (!isNullOrEmpty(icannReferralEmail) && oldRegistrar == null) {
|
||||
// On creates, fall back to ICANN referral email (if present).
|
||||
builder.setEmailAddress(icannReferralEmail);
|
||||
}
|
||||
if (url != null) {
|
||||
|
|
|
@ -637,10 +637,12 @@ class UpdateRegistrarCommandTest extends CommandTestCase<UpdateRegistrarCommand>
|
|||
|
||||
@Test
|
||||
void testSuccess_setIcannEmail() throws Exception {
|
||||
runCommand("--icann_referral_email=foo@bar.test", "--force", "TheRegistrar");
|
||||
Registrar registrar = loadRegistrar("TheRegistrar");
|
||||
assertThat(registrar.getIcannReferralEmail()).isEqualTo("foo@bar.test");
|
||||
assertThat(registrar.getEmailAddress()).isEqualTo("foo@bar.test");
|
||||
assertThat(registrar.getEmailAddress()).isEqualTo("the.registrar@example.com");
|
||||
runCommand("--icann_referral_email=foo@bar.test", "--force", "TheRegistrar");
|
||||
Registrar updatedRegistrar = loadRegistrar("TheRegistrar");
|
||||
assertThat(updatedRegistrar.getIcannReferralEmail()).isEqualTo("foo@bar.test");
|
||||
assertThat(updatedRegistrar.getEmailAddress()).isEqualTo("the.registrar@example.com");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue