Skip to content

Commit

Permalink
Change email body to use the new streetLine field
Browse files Browse the repository at this point in the history
  • Loading branch information
hstonec committed Feb 6, 2020
1 parent 722209e commit ed1b725
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
Expand Up @@ -57,11 +57,11 @@ public class Address extends ImmutableObject implements Jsonifiable {
@Transient
List<String> street;

@Ignore String streetLine1;
@Ignore @XmlTransient String streetLine1;

@Ignore String streetLine2;
@Ignore @XmlTransient String streetLine2;

@Ignore String streetLine3;
@Ignore @XmlTransient String streetLine3;

@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
String city;
Expand Down Expand Up @@ -189,7 +189,7 @@ public Builder<T> setCountryCode(String countryCode) {
}
}

private void onload(@AlsoLoad("street") List<String> street) {
void onload(@AlsoLoad("street") List<String> street) {
if (street == null || street.size() == 0) {
return;
}
Expand Down
Expand Up @@ -65,6 +65,7 @@
import java.util.Optional;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Stream;
import javax.inject.Inject;
import org.joda.time.DateTime;

Expand Down Expand Up @@ -254,6 +255,18 @@ private Map<String, Object> expandRegistrarWithContacts(
.collect(toImmutableSet());
// Use LinkedHashMap here to preserve ordering; null values mean we can't use ImmutableMap.
LinkedHashMap<String, Object> result = new LinkedHashMap<>(registrar.toDiffableFieldMap());
// Remove the street field in both localizedAddress and internationalizedAddress as it will be
// replaced by the
// streetLine[1-3] fields after the database migration
Stream.of(result.get("localizedAddress"), result.get("internationalizedAddress"))
.filter(Objects::nonNull)
.forEach(
obj -> {
Map<String, Object> map = (Map<String, Object>) obj;
if (map.containsKey("street")) {
map.remove("street");
}
});
result.put("contacts", expandedContacts);
return result;
}
Expand Down
Expand Up @@ -2,8 +2,8 @@ The following changes were made in registry unittest environment to the registra

whoisServer: null -> foo.bar.baz
ipAddressWhitelist: null -> [1.1.1.1/32, 2.2.2.2/32, 4.4.4.4/32]
localizedAddress.street.0: 123 Example Bőulevard -> 123 Street Rd
localizedAddress.street.1: null -> Ste 156
localizedAddress.streetLine1: 123 Example Bőulevard -> 123 Street Rd
localizedAddress.streetLine2: null -> Ste 156
localizedAddress.city: Williamsburg -> New York
localizedAddress.zip: 11211 -> 10011
phoneNumber: +1.2223334444 -> +1.2223335555
Expand Down

0 comments on commit ed1b725

Please sign in to comment.