feat(developers): simplify timezone dropdown and make email optional
All checks were successful
Build and Deploy / deploy (push) Successful in 42s
All checks were successful
Build and Deploy / deploy (push) Successful in 42s
Replace 100+ raw system timezones with curated list of 26 major zones with browser auto-detection via Intl API. Remove email requirement since applicants receive a @silverlabs.uk address — fallback to username@silverlabs.uk when no personal email is provided. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -48,11 +48,16 @@ public class DeveloperApplicationService
|
||||
{
|
||||
try
|
||||
{
|
||||
// Use silverlabs.uk address when no personal email provided
|
||||
var effectiveEmail = string.IsNullOrWhiteSpace(application.Email)
|
||||
? $"{application.DesiredUsername}@silverlabs.uk"
|
||||
: application.Email.Trim();
|
||||
|
||||
// 1. Register user on SilverDESK
|
||||
var registerPayload = new
|
||||
{
|
||||
username = application.DesiredUsername,
|
||||
email = application.Email,
|
||||
email = effectiveEmail,
|
||||
password = application.Password,
|
||||
fullName = application.FullName
|
||||
};
|
||||
@@ -111,7 +116,7 @@ public class DeveloperApplicationService
|
||||
userId,
|
||||
ticketId,
|
||||
fullName = application.FullName,
|
||||
email = application.Email,
|
||||
email = effectiveEmail,
|
||||
desiredUsername = application.DesiredUsername,
|
||||
timezone = application.Timezone,
|
||||
appliedRole = application.Role.ToString(),
|
||||
@@ -126,29 +131,29 @@ public class DeveloperApplicationService
|
||||
|
||||
if (appResponse.IsSuccessStatusCode)
|
||||
{
|
||||
_logger.LogInformation("DeveloperApplication record created for {Email}", application.Email);
|
||||
_logger.LogInformation("DeveloperApplication record created for {Email}", effectiveEmail);
|
||||
}
|
||||
else
|
||||
{
|
||||
var appError = await appResponse.Content.ReadAsStringAsync();
|
||||
_logger.LogWarning("Failed to create DeveloperApplication record for {Email}: {StatusCode} - {Body}",
|
||||
application.Email, appResponse.StatusCode, appError);
|
||||
effectiveEmail, appResponse.StatusCode, appError);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Failed to create DeveloperApplication record for {Email} — user and ticket were created successfully",
|
||||
application.Email);
|
||||
effectiveEmail);
|
||||
}
|
||||
|
||||
_logger.LogInformation("Developer application submitted for {Email} as {Role} — user registered and ticket created",
|
||||
application.Email, application.Role);
|
||||
effectiveEmail, application.Role);
|
||||
|
||||
return (true, "Application submitted successfully! Your SilverDESK account has been created.", token);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error submitting developer application for {Email}", application.Email);
|
||||
_logger.LogError(ex, "Error submitting developer application for {Username}", application.DesiredUsername);
|
||||
return (false, "Unable to connect to the application service. Please try again later.", null);
|
||||
}
|
||||
}
|
||||
@@ -177,12 +182,16 @@ public class DeveloperApplicationService
|
||||
|
||||
private static string FormatTicketBody(DeveloperApplication app)
|
||||
{
|
||||
var effectiveEmail = string.IsNullOrWhiteSpace(app.Email)
|
||||
? $"{app.DesiredUsername}@silverlabs.uk"
|
||||
: app.Email.Trim();
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine("## Developer Program Application");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine($"**Role:** {app.Role}");
|
||||
sb.AppendLine($"**Full Name:** {app.FullName}");
|
||||
sb.AppendLine($"**Email:** {app.Email}");
|
||||
sb.AppendLine($"**Email:** {effectiveEmail}");
|
||||
sb.AppendLine($"**Desired Username:** {app.DesiredUsername}");
|
||||
sb.AppendLine($"**Timezone:** {app.Timezone}");
|
||||
sb.AppendLine();
|
||||
|
||||
Reference in New Issue
Block a user