mirror of
https://github.com/google/nomulus
synced 2026-06-09 16:33:02 +00:00
Flat-map registry lock emails to avoid unclean errors in bad situations (#525)
* Flat map to avoid unclean errors in bad situations Also properly reflect that for admins, we will use their user email * Make MS's GAE user ID a public static field
This commit is contained in:
@@ -159,9 +159,10 @@ public final class RegistryLockGetAction implements JsonGetAction {
|
||||
isAdmin || contactOptional.map(RegistrarContact::isRegistryLockAllowed).orElse(false);
|
||||
// Use the contact's registry lock email if it's present, else use the login email (for admins)
|
||||
String relevantEmail =
|
||||
contactOptional
|
||||
.map(contact -> contact.getRegistryLockEmailAddress().get())
|
||||
.orElse(user.getEmail());
|
||||
isAdmin
|
||||
? user.getEmail()
|
||||
// if the contact isn't present, we shouldn't display the email anyway so empty is fine
|
||||
: contactOptional.flatMap(RegistrarContact::getRegistryLockEmailAddress).orElse("");
|
||||
return ImmutableMap.of(
|
||||
LOCK_ENABLED_FOR_CONTACT_PARAM,
|
||||
isRegistryLockAllowed,
|
||||
|
||||
Reference in New Issue
Block a user