Redirect Registrar.referralUrl UI actions to url field

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=196597051
This commit is contained in:
larryruili 2018-05-14 17:49:57 -07:00 committed by jianglai
parent de5645abd9
commit 6cdbde107f
23 changed files with 18 additions and 59 deletions

View file

@ -1381,13 +1381,6 @@ public final class RegistryConfig {
return CONFIG_SETTINGS.get().registryPolicy.defaultRegistrarWhoisServer;
}
/**
* Returns the default referral URL that is used unless registrars have specified otherwise.
*/
public static String getDefaultRegistrarReferralUrl() {
return CONFIG_SETTINGS.get().registryPolicy.defaultRegistrarReferralUrl;
}
/**
* Returns the number of {@code EppResourceIndex} buckets to be used.
*/

View file

@ -58,9 +58,6 @@ registryPolicy:
# Default WHOIS server used when not specified on a registrar.
defaultRegistrarWhoisServer: whois.domain-registry.example
# Default referral URL used when not changed by a registrar.
defaultRegistrarReferralUrl: https://www.domain-registry.example
# Mode TMCH should run in (PRODUCTION for production environments, PILOT for
# all others including sandbox).
tmchCaMode: PILOT

View file

@ -24,7 +24,6 @@ registryPolicy:
- placeholder
- placeholder
defaultRegistrarWhoisServer: placeholder
defaultRegistrarReferralUrl: placeholder
tmchCaMode: PRODUCTION
tmchCrlUrl: http://crl.icann.org/tmch.crl
tmchMarksDbUrl: https://ry.marksdb.org

View file

@ -6,7 +6,6 @@ registryPolicy:
- notification@test.example
- notification2@test.example
defaultRegistrarWhoisServer: whois.nic.fakewhois.example
defaultRegistrarReferralUrl: http://www.referral.example/path
datastore:
commitLogBucketsNum: 3

View file

@ -147,7 +147,7 @@ class SyncRegistrarsSheet {
builder.put("blockPremiumNames", convert(registrar.getBlockPremiumNames()));
builder.put("ipAddressWhitelist", convert(registrar.getIpAddressWhitelist()));
builder.put("url", convert(registrar.getUrl()));
builder.put("referralUrl", convert(registrar.getReferralUrl()));
builder.put("referralUrl", convert(registrar.getUrl()));
builder.put("icannReferralEmail", convert(registrar.getIcannReferralEmail()));
return builder.build();
})

View file

@ -24,7 +24,6 @@ import static com.google.common.collect.ImmutableSortedSet.toImmutableSortedSet;
import static com.google.common.collect.Ordering.natural;
import static com.google.common.collect.Sets.immutableEnumSet;
import static com.google.common.io.BaseEncoding.base64;
import static google.registry.config.RegistryConfig.getDefaultRegistrarReferralUrl;
import static google.registry.config.RegistryConfig.getDefaultRegistrarWhoisServer;
import static google.registry.model.CacheUtils.memoizeWithShortExpiration;
import static google.registry.model.common.EntityGroupRoot.getCrossTldKey;
@ -364,9 +363,6 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
/** URL of registrar's website. */
String url;
/** Referral URL of registrar. */
String referralUrl;
/**
* ICANN referral email address.
*
@ -551,10 +547,6 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
return url;
}
public String getReferralUrl() {
return firstNonNull(referralUrl, getDefaultRegistrarReferralUrl());
}
public String getIcannReferralEmail() {
return nullToEmpty(icannReferralEmail);
}
@ -617,7 +609,6 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
.put("blockPremiumNames", blockPremiumNames)
.put("premiumPriceAckRequired", premiumPriceAckRequired)
.put("url", url)
.put("referralUrl", getReferralUrl())
.put("icannReferralEmail", getIcannReferralEmail())
.put("driveFolderId", driveFolderId)
.put("phoneNumber", phoneNumber)
@ -833,11 +824,6 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
return this;
}
public Builder setReferralUrl(String referralUrl) {
getInstance().referralUrl = referralUrl;
return this;
}
public Builder setIcannReferralEmail(String icannReferralEmail) {
getInstance().icannReferralEmail = icannReferralEmail;
return this;

View file

@ -154,10 +154,6 @@ public final class RegistrarFormFields {
FormFields.MIN_TOKEN.asBuilderNamed("url")
.build();
public static final FormField<String, String> REFERRAL_URL_FIELD =
FormFields.MIN_TOKEN.asBuilderNamed("referralUrl")
.build();
public static final FormField<List<String>, List<CidrAddressBlock>> IP_ADDRESS_WHITELIST_FIELD =
FormField.named("ipAddressWhitelist")
.emptyToNull()

View file

@ -224,8 +224,7 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA
// WHOIS
builder.setWhoisServer(
RegistrarFormFields.WHOIS_SERVER_FIELD.extractUntyped(args).orElse(null));
builder.setReferralUrl(
RegistrarFormFields.REFERRAL_URL_FIELD.extractUntyped(args).orElse(null));
builder.setUrl(RegistrarFormFields.URL_FIELD.extractUntyped(args).orElse(null));
// If the email is already null / empty - we can keep it so. But if it's set - it's required to
// remain set.
@ -241,8 +240,6 @@ public class RegistrarSettingsAction implements Runnable, JsonActionRunner.JsonA
builder.setLocalizedAddress(
RegistrarFormFields.L10N_ADDRESS_FIELD.extractUntyped(args).orElse(null));
builder.setUrl(RegistrarFormFields.URL_FIELD.extractUntyped(args).orElse(null));
// Security
builder.setIpAddressWhitelist(
RegistrarFormFields.IP_ADDRESS_WHITELIST_FIELD

View file

@ -23,14 +23,14 @@
{@param icannReferralEmail: string}
{@param readonly: bool}
{@param? whoisServer: string}
{@param? referralUrl: string}
{@param? url: string}
// Passed to .contactInfo_
{@param? emailAddress: string}
{@param? localizedAddress: ?}
{@param? phoneNumber: string}
{@param? faxNumber: string}
{let $whoisServerNonNull: $whoisServer ?: 'None' /}
{let $referralUrlNonNull: $referralUrl ?: 'None' /}
{let $urlNonNull: $url ?: 'None' /}
<form name="item" class="{css('item')} {css('registrar')} {css('kd-settings-pane')}">
<h1>WHOIS Settings</h1>
{if $readonly}
@ -66,8 +66,8 @@
{/call}
{call registry.soy.forms.inputFieldRowWithValue}
{param label: 'Referral URL' /}
{param name: 'referralUrl' /}
{param value: $referralUrlNonNull /}
{param name: 'url' /}
{param value: $urlNonNull /}
{param readonly: $readonly /}
{/call}
</table>

View file

@ -16,7 +16,6 @@ package google.registry.export.sheet;
import static com.google.common.collect.Iterables.getOnlyElement;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.config.RegistryConfig.getDefaultRegistrarReferralUrl;
import static google.registry.config.RegistryConfig.getDefaultRegistrarWhoisServer;
import static google.registry.model.common.Cursor.CursorType.SYNC_REGISTRAR_SHEET;
import static google.registry.model.ofy.ObjectifyService.ofy;
@ -278,7 +277,7 @@ public class SyncRegistrarsSheetTest {
assertThat(row).containsEntry("url", "http://www.example.org/aaa_registrar");
assertThat(row).containsEntry("icannReferralEmail", "");
assertThat(row).containsEntry("whoisServer", getDefaultRegistrarWhoisServer());
assertThat(row).containsEntry("referralUrl", getDefaultRegistrarReferralUrl());
assertThat(row).containsEntry("referralUrl", "http://www.example.org/aaa_registrar");
assertThat(row).containsEntry("billingAccountMap", "{JPY=JPY7890, USD=USD1234}");
row = rows.get(1);
@ -311,7 +310,7 @@ public class SyncRegistrarsSheetTest {
assertThat(row).containsEntry("blockPremiumNames", "false");
assertThat(row).containsEntry("ipAddressWhitelist", "");
assertThat(row).containsEntry("url", "http://www.example.org/another_registrar");
assertThat(row).containsEntry("referralUrl", getDefaultRegistrarReferralUrl());
assertThat(row).containsEntry("referralUrl", "http://www.example.org/another_registrar");
assertThat(row).containsEntry("icannReferralEmail", "jim@example.net");
assertThat(row).containsEntry("billingAccountMap", "{}");
@ -355,7 +354,7 @@ public class SyncRegistrarsSheetTest {
assertThat(row).containsEntry("blockPremiumNames", "false");
assertThat(row).containsEntry("ipAddressWhitelist", "");
assertThat(row).containsEntry("url", "");
assertThat(row).containsEntry("referralUrl", getDefaultRegistrarReferralUrl());
assertThat(row).containsEntry("referralUrl", "");
assertThat(row).containsEntry("icannReferralEmail", "");
assertThat(row).containsEntry("billingAccountMap", "{}");
}

View file

@ -88,7 +88,6 @@ public class RegistrarTest extends EntityTestCase {
.setFaxNumber("+1.2125551213")
.setEmailAddress("contact-us@example.com")
.setUrl("http://www.example.com")
.setReferralUrl("http://www.example.com")
.setIcannReferralEmail("foo@example.com")
.setDriveFolderId("drive folder id")
.setIanaIdentifier(8L)

View file

@ -608,7 +608,6 @@ class google.registry.model.registrar.Registrar {
java.lang.String passwordHash;
java.lang.String phoneNumber;
java.lang.String phonePasscode;
java.lang.String referralUrl;
java.lang.String registrarName;
java.lang.String salt;
java.lang.String url;

View file

@ -70,6 +70,7 @@ public class RdeMarshallerTest extends ShardableTestCase {
+ " </rdeRegistrar:postalInfo>\n"
+ " <rdeRegistrar:voice>+1.2223334444</rdeRegistrar:voice>\n"
+ " <rdeRegistrar:email>new.registrar@example.com</rdeRegistrar:email>\n"
+ " <rdeRegistrar:url>http://my.fake.url</rdeRegistrar:url>\n"
+ " <rdeRegistrar:whoisInfo>\n"
+ " <rdeRegistrar:name>whois.nic.fakewhois.example</rdeRegistrar:name>\n"
+ " </rdeRegistrar:whoisInfo>\n"

View file

@ -62,6 +62,7 @@
</rdeRegistrar:postalInfo>
<rdeRegistrar:voice>+1.3334445555</rdeRegistrar:voice>
<rdeRegistrar:email>new.registrar@example.com</rdeRegistrar:email>
<rdeRegistrar:url>http://my.fake.url</rdeRegistrar:url>
<rdeRegistrar:whoisInfo>
<rdeRegistrar:name>whois.nic.fakewhois.example</rdeRegistrar:name>
</rdeRegistrar:whoisInfo>
@ -94,6 +95,7 @@
</rdeRegistrar:postalInfo>
<rdeRegistrar:voice>+1.2223334444</rdeRegistrar:voice>
<rdeRegistrar:email>new.registrar@example.com</rdeRegistrar:email>
<rdeRegistrar:url>http://my.fake.url</rdeRegistrar:url>
<rdeRegistrar:whoisInfo>
<rdeRegistrar:name>whois.nic.fakewhois.example</rdeRegistrar:name>
</rdeRegistrar:whoisInfo>

View file

@ -165,6 +165,7 @@ public final class AppEngineRule extends ExternalResource {
.setState(State.ACTIVE)
.setEmailAddress("new.registrar@example.com")
.setIcannReferralEmail("lol@sloth.test")
.setUrl("http://my.fake.url")
.setInternationalizedAddress(new RegistrarAddress.Builder()
.setStreet(ImmutableList.of("123 Example Boulevard"))
.setCity("Williamsburg")

View file

@ -80,7 +80,6 @@ public final class FullFieldsTestEntityHelper {
.setFaxNumber("+1.2125551213")
.setEmailAddress("contact-us@example.com")
.setWhoisServer("whois.example.com")
.setReferralUrl("http://www.example.com")
.setUrl("http://my.fake.url")
.build();
}

View file

@ -82,7 +82,7 @@ function createTestRegistrar() {
ianaIdentifier: 1,
icannReferralEmail: 'lol@sloth.test',
whoisServer: 'foo.bar.baz',
referralUrl: 'blah.blar',
url: 'blah.blar',
phoneNumber: '+1.2125650000',
faxNumber: '+1.2125650001',
localizedAddress: {

View file

@ -214,12 +214,6 @@ public class RegistrarSettingsActionTest extends RegistrarSettingsActionTestCase
doTestUpdate(Registrar::getWhoisServer, "new-whois.example", Registrar.Builder::setWhoisServer);
}
@Test
public void testUpdate_referralUrl() throws Exception {
doTestUpdate(
Registrar::getReferralUrl, "new-reference-url.example", Registrar.Builder::setReferralUrl);
}
@Test
public void testUpdate_phoneNumber() throws Exception {
doTestUpdate(Registrar::getPhoneNumber, "+1.2345678900", Registrar.Builder::setPhoneNumber);

View file

@ -15,7 +15,6 @@
package google.registry.ui.server.registrar;
import static com.google.common.truth.Truth.assertThat;
import static google.registry.config.RegistryConfig.getDefaultRegistrarReferralUrl;
import static google.registry.config.RegistryConfig.getDefaultRegistrarWhoisServer;
import static google.registry.testing.CertificateSamples.SAMPLE_CERT;
import static google.registry.testing.CertificateSamples.SAMPLE_CERT2;
@ -53,12 +52,11 @@ public class SecuritySettingsTest extends RegistrarSettingsActionTestCase {
Map<String, Object> response = action.handleJsonRequest(ImmutableMap.of(
"op", "update",
"args", modified.toJsonMap()));
// Empty whoisServer and referralUrl fields should be set to defaults by server.
// Empty whoisServer field should be set to default by server.
modified =
modified
.asBuilder()
.setWhoisServer(getDefaultRegistrarWhoisServer())
.setReferralUrl(getDefaultRegistrarReferralUrl())
.build();
assertThat(response).containsEntry("status", "SUCCESS");
assertThat(response).containsEntry("results", asList(modified.toJsonMap()));

View file

@ -44,7 +44,7 @@ public class WhoisSettingsTest extends RegistrarSettingsActionTestCase {
.setEmailAddress("hello.kitty@example.com")
.setPhoneNumber("+1.2125650000")
.setFaxNumber("+1.2125650001")
.setReferralUrl("http://acme.com/")
.setUrl("http://acme.com/")
.setWhoisServer("ns1.foo.bar")
.setLocalizedAddress(
new RegistrarAddress.Builder()

View file

@ -51,7 +51,7 @@
"url": null,
"icannReferralEmail": "asdf@asdf.com",
"phonePasscode": null,
"referralUrl": "",
"url": "http://my.new.url",
"blockPremiumNames": false,
"lastCertificateUpdateTime": null,
"e": false

View file

@ -7,6 +7,7 @@ localizedAddress.city: Williamsburg -> New York
localizedAddress.zip: 11211 -> 10011
phoneNumber: +1.2223334444 -> +1.2223335555
emailAddress: new.registrar@example.com -> thase@the.registrar
url: http://my.fake.url -> http://my.new.url
contacts:
ADDED:
{parent=Key<?>(EntityGroupRoot("cross-tld")/Registrar("TheRegistrar")), name=Extra Terrestrial, emailAddress=etphonehome@example.com, phoneNumber=null, faxNumber=null, types=[ADMIN, BILLING, TECH, WHOIS], gaeUserId=null, visibleInWhoisAsAdmin=true, visibleInWhoisAsTech=false, visibleInDomainWhoisAsAbuse=false}

View file

@ -62,7 +62,6 @@ public class RegistrarWhoisResponseTest {
.setFaxNumber("+1.3105551213")
.setEmailAddress("registrar@example.tld")
.setWhoisServer("whois.example-registrar.tld")
.setReferralUrl("http://www.example-registrar.tld")
.setUrl("http://my.fake.url")
.build();
// Use the registrar key for contacts' parent.