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 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 int Port { get; set; } = 587;
|
||||||
public required string Username { get; set; }
|
public string Username { get; set; } = string.Empty;
|
||||||
public required string Password { get; set; }
|
public string Password { get; set; } = string.Empty;
|
||||||
public bool UseSsl { get; set; } = true;
|
public bool UseSsl { get; set; } = true;
|
||||||
public required string FromEmail { get; set; }
|
public string FromEmail { get; set; } = string.Empty;
|
||||||
public required string FromName { get; set; }
|
public string FromName { get; set; } = string.Empty;
|
||||||
public required string AppDisplayName { get; set; }
|
|
||||||
public required string AppBaseUrl { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,8 +55,7 @@ public class AdminChannelsController : Controller
|
|||||||
var channel = result.Result;
|
var channel = result.Result;
|
||||||
var smtp = channel.Settings as SmtpChannelSettings ?? new SmtpChannelSettings
|
var smtp = channel.Settings as SmtpChannelSettings ?? new SmtpChannelSettings
|
||||||
{
|
{
|
||||||
Host = "", Username = "", Password = "",
|
Host = "", Username = "", Password = "", FromEmail = "", FromName = ""
|
||||||
FromEmail = "", FromName = "", AppDisplayName = "", AppBaseUrl = ""
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var vm = new EmailChannelEditViewModel
|
var vm = new EmailChannelEditViewModel
|
||||||
@@ -75,9 +74,7 @@ public class AdminChannelsController : Controller
|
|||||||
Password = smtp.Password,
|
Password = smtp.Password,
|
||||||
UseSsl = smtp.UseSsl,
|
UseSsl = smtp.UseSsl,
|
||||||
FromEmail = smtp.FromEmail,
|
FromEmail = smtp.FromEmail,
|
||||||
FromName = smtp.FromName,
|
FromName = smtp.FromName
|
||||||
AppDisplayName = smtp.AppDisplayName,
|
|
||||||
AppBaseUrl = smtp.AppBaseUrl
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return View(vm);
|
return View(vm);
|
||||||
@@ -99,9 +96,7 @@ public class AdminChannelsController : Controller
|
|||||||
Password = model.Password,
|
Password = model.Password,
|
||||||
UseSsl = model.UseSsl,
|
UseSsl = model.UseSsl,
|
||||||
FromEmail = model.FromEmail,
|
FromEmail = model.FromEmail,
|
||||||
FromName = model.FromName,
|
FromName = model.FromName
|
||||||
AppDisplayName = model.AppDisplayName,
|
|
||||||
AppBaseUrl = model.AppBaseUrl
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (model.IsNew)
|
if (model.IsNew)
|
||||||
|
|||||||
-6
@@ -45,12 +45,6 @@ public class EmailChannelEditViewModel
|
|||||||
[Required]
|
[Required]
|
||||||
public string FromName { get; set; } = "";
|
public string FromName { get; set; } = "";
|
||||||
|
|
||||||
[Required]
|
|
||||||
public string AppDisplayName { get; set; } = "";
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
public string AppBaseUrl { get; set; } = "";
|
|
||||||
|
|
||||||
// ── Computed ───────────────────────────────────────────────────────
|
// ── Computed ───────────────────────────────────────────────────────
|
||||||
public bool IsNew => Id == Guid.Empty;
|
public bool IsNew => Id == Guid.Empty;
|
||||||
public string PageTitle => IsNew ? "Create Channel" : "Edit Channel";
|
public string PageTitle => IsNew ? "Create Channel" : "Edit Channel";
|
||||||
|
|||||||
@@ -117,19 +117,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</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 {
|
@section FormActions {
|
||||||
<button type="submit" form="channelForm" class="btn btn-primary">
|
<button type="submit" form="channelForm" class="btn btn-primary">
|
||||||
<i class="bi bi-floppy me-1"></i> Save
|
<i class="bi bi-floppy me-1"></i> Save
|
||||||
|
|||||||
Reference in New Issue
Block a user