mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +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.Admin.Notification;
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
|
|
||||||
namespace Orchard.Email.Services
|
namespace Orchard.Email.Services {
|
||||||
{
|
public class MissingSettingsBanner : INotificationProvider {
|
||||||
public class MissingSettingsBanner : INotificationProvider
|
|
||||||
{
|
|
||||||
private readonly IOrchardServices _orchardServices;
|
private readonly IOrchardServices _orchardServices;
|
||||||
private readonly WorkContext _workContext;
|
|
||||||
|
|
||||||
public MissingSettingsBanner(IOrchardServices orchardServices, IWorkContextAccessor workContextAccessor)
|
public MissingSettingsBanner(IOrchardServices orchardServices) {
|
||||||
{
|
|
||||||
_orchardServices = orchardServices;
|
_orchardServices = orchardServices;
|
||||||
_workContext = workContextAccessor.GetContext();
|
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Localizer T { get; set; }
|
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);
|
||||||
if (smtpSettings == null || !smtpSettings.IsValid())
|
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};
|
||||||
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