diff --git a/src/Orchard.Web/Modules/Orchard.Email/Services/MissingSettingsBanner.cs b/src/Orchard.Web/Modules/Orchard.Email/Services/MissingSettingsBanner.cs index f2d639cb1..0e95da148 100644 --- a/src/Orchard.Web/Modules/Orchard.Email/Services/MissingSettingsBanner.cs +++ b/src/Orchard.Web/Modules/Orchard.Email/Services/MissingSettingsBanner.cs @@ -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 GetNotifications() - { + public IEnumerable GetNotifications() { + var workContext = _orchardServices.WorkContext; + var smtpSettings = workContext.CurrentSite.As(); - var smtpSettings = _orchardServices.WorkContext.CurrentSite.As(); - - 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 SMTP settings 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 SMTP settings needs to be configured.", url), Type = NotifyType.Warning}; } } }