Removing unnecessary code from MessageSettingsBanner constructor

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-06-21 10:57:46 -07:00
parent 3ddc59a253
commit 5bbcbb85b6

View File

@@ -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};
}
}
}