mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 11:44:58 +08:00
Removing unnecessary code from MessageSettingsBanner constructor
--HG-- branch : 1.x
This commit is contained in:
@@ -6,32 +6,25 @@ using Orchard.Localization;
|
||||
using Orchard.UI.Admin.Notification;
|
||||
using Orchard.UI.Notify;
|
||||
|
||||
namespace Orchard.Email.Services
|
||||
{
|
||||
public class MissingSettingsBanner : INotificationProvider
|
||||
{
|
||||
namespace Orchard.Email.Services {
|
||||
public class MissingSettingsBanner : INotificationProvider {
|
||||
private readonly IOrchardServices _orchardServices;
|
||||
private readonly WorkContext _workContext;
|
||||
|
||||
public MissingSettingsBanner(IOrchardServices orchardServices, IWorkContextAccessor workContextAccessor)
|
||||
{
|
||||
public MissingSettingsBanner(IOrchardServices orchardServices) {
|
||||
_orchardServices = orchardServices;
|
||||
_workContext = workContextAccessor.GetContext();
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public IEnumerable<NotifyEntry> GetNotifications()
|
||||
{
|
||||
public IEnumerable<NotifyEntry> GetNotifications() {
|
||||
var workContext = _orchardServices.WorkContext;
|
||||
var smtpSettings = workContext.CurrentSite.As<SmtpSettingsPart>();
|
||||
|
||||
var smtpSettings = _orchardServices.WorkContext.CurrentSite.As<SmtpSettingsPart>();
|
||||
|
||||
if (smtpSettings == null || !smtpSettings.IsValid())
|
||||
{
|
||||
var urlHelper = new UrlHelper(_workContext.HttpContext.Request.RequestContext);
|
||||
var url = urlHelper.Action("Email", "Admin", new { Area = "Settings" });
|
||||
yield return new NotifyEntry { Message = T("The <a href=\"{0}\">SMTP settings</a> needs to be configured.", url), Type = NotifyType.Warning };
|
||||
if (smtpSettings == null || !smtpSettings.IsValid()) {
|
||||
var urlHelper = new UrlHelper(workContext.HttpContext.Request.RequestContext);
|
||||
var url = urlHelper.Action("Email", "Admin", new {Area = "Settings"});
|
||||
yield return new NotifyEntry {Message = T("The <a href=\"{0}\">SMTP settings</a> needs to be configured.", url), Type = NotifyType.Warning};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user