refactor: channel holds delivery config only — remove AppDisplayName, AppBaseUrl
- SmtpChannelSettings: Host, Port, Username, Password, UseSsl, FromEmail, FromName only - AppDisplayName and AppBaseUrl moved to template variables (payload responsibility) - Updated ViewModel, controller Save/Edit mapping, and Edit view accordingly Ref: IT-628 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -9,13 +9,11 @@ public class SmtpChannelSettings : EmailChannelSettings
|
||||
{
|
||||
public override EmailChannelType EmailChannelType => EmailChannelType.Smtp;
|
||||
|
||||
public required string Host { get; set; }
|
||||
public string Host { get; set; } = string.Empty;
|
||||
public int Port { get; set; } = 587;
|
||||
public required string Username { get; set; }
|
||||
public required string Password { get; set; }
|
||||
public string Username { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
public bool UseSsl { get; set; } = true;
|
||||
public required string FromEmail { get; set; }
|
||||
public required string FromName { get; set; }
|
||||
public required string AppDisplayName { get; set; }
|
||||
public required string AppBaseUrl { get; set; }
|
||||
public string FromEmail { get; set; } = string.Empty;
|
||||
public string FromName { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
@@ -55,8 +55,7 @@ public class AdminChannelsController : Controller
|
||||
var channel = result.Result;
|
||||
var smtp = channel.Settings as SmtpChannelSettings ?? new SmtpChannelSettings
|
||||
{
|
||||
Host = "", Username = "", Password = "",
|
||||
FromEmail = "", FromName = "", AppDisplayName = "", AppBaseUrl = ""
|
||||
Host = "", Username = "", Password = "", FromEmail = "", FromName = ""
|
||||
};
|
||||
|
||||
var vm = new EmailChannelEditViewModel
|
||||
@@ -75,9 +74,7 @@ public class AdminChannelsController : Controller
|
||||
Password = smtp.Password,
|
||||
UseSsl = smtp.UseSsl,
|
||||
FromEmail = smtp.FromEmail,
|
||||
FromName = smtp.FromName,
|
||||
AppDisplayName = smtp.AppDisplayName,
|
||||
AppBaseUrl = smtp.AppBaseUrl
|
||||
FromName = smtp.FromName
|
||||
};
|
||||
|
||||
return View(vm);
|
||||
@@ -99,9 +96,7 @@ public class AdminChannelsController : Controller
|
||||
Password = model.Password,
|
||||
UseSsl = model.UseSsl,
|
||||
FromEmail = model.FromEmail,
|
||||
FromName = model.FromName,
|
||||
AppDisplayName = model.AppDisplayName,
|
||||
AppBaseUrl = model.AppBaseUrl
|
||||
FromName = model.FromName
|
||||
};
|
||||
|
||||
if (model.IsNew)
|
||||
|
||||
-6
@@ -45,12 +45,6 @@ public class EmailChannelEditViewModel
|
||||
[Required]
|
||||
public string FromName { get; set; } = "";
|
||||
|
||||
[Required]
|
||||
public string AppDisplayName { get; set; } = "";
|
||||
|
||||
[Required]
|
||||
public string AppBaseUrl { get; set; } = "";
|
||||
|
||||
// ── Computed ───────────────────────────────────────────────────────
|
||||
public bool IsNew => Id == Guid.Empty;
|
||||
public string PageTitle => IsNew ? "Create Channel" : "Edit Channel";
|
||||
|
||||
@@ -117,19 +117,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-6">
|
||||
<label asp-for="AppDisplayName" class="form-label fw-semibold">App Display Name</label>
|
||||
<input asp-for="AppDisplayName" class="form-control" />
|
||||
<span asp-validation-for="AppDisplayName" class="text-danger small"></span>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label asp-for="AppBaseUrl" class="form-label fw-semibold">App Base URL</label>
|
||||
<input asp-for="AppBaseUrl" class="form-control" placeholder="https://example.com" />
|
||||
<span asp-validation-for="AppBaseUrl" class="text-danger small"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section FormActions {
|
||||
<button type="submit" form="channelForm" class="btn btn-primary">
|
||||
<i class="bi bi-floppy me-1"></i> Save
|
||||
|
||||
Reference in New Issue
Block a user