Fixes UI error when there is an unathorized request, fixes NotificationService to accept IContent since that's all it supports
This commit is contained in:
@@ -22,7 +22,7 @@ namespace Umbraco.Core.Services
|
||||
/// <param name="http"></param>
|
||||
/// <param name="createSubject"></param>
|
||||
/// <param name="createBody"></param>
|
||||
void SendNotifications(IUser operatingUser, IEnumerable<IUmbracoEntity> entities, string action, string actionName, Uri siteUri,
|
||||
void SendNotifications(IUser operatingUser, IEnumerable<IContent> entities, string action, string actionName, Uri siteUri,
|
||||
Func<(IUser user, NotificationEmailSubjectParams subject), string> createSubject,
|
||||
Func<(IUser user, NotificationEmailBodyParams body, bool isHtml), string> createBody);
|
||||
|
||||
|
||||
@@ -66,17 +66,11 @@ namespace Umbraco.Core.Services.Implement
|
||||
/// <param name="siteUri"></param>
|
||||
/// <param name="createSubject"></param>
|
||||
/// <param name="createBody"></param>
|
||||
/// <remarks>
|
||||
/// Currently this will only work for Content entities!
|
||||
/// </remarks>
|
||||
public void SendNotifications(IUser operatingUser, IEnumerable<IUmbracoEntity> entities, string action, string actionName, Uri siteUri,
|
||||
public void SendNotifications(IUser operatingUser, IEnumerable<IContent> entities, string action, string actionName, Uri siteUri,
|
||||
Func<(IUser user, NotificationEmailSubjectParams subject), string> createSubject,
|
||||
Func<(IUser user, NotificationEmailBodyParams body, bool isHtml), string> createBody)
|
||||
{
|
||||
if (entities is IEnumerable<IContent> == false)
|
||||
throw new NotSupportedException();
|
||||
|
||||
var entitiesL = entities as List<IContent> ?? entities.Cast<IContent>().ToList();
|
||||
var entitiesL = entities.ToList();
|
||||
|
||||
//exit if there are no entities
|
||||
if (entitiesL.Count == 0) return;
|
||||
|
||||
@@ -102,11 +102,8 @@
|
||||
|
||||
//It was decided to just put these messages into the normal status messages.
|
||||
|
||||
var msg = "Unauthorized access to URL: <br/><i>" + rejection.config.url.split('?')[0] + "</i>";
|
||||
if (rejection.config.data) {
|
||||
msg += "<br/> with data: <br/><i>" + angular.toJson(rejection.config.data) + "</i><br/>Contact your administrator for information.";
|
||||
}
|
||||
|
||||
var msg = "Unauthorized access to URL: <br/><i>" + rejection.config.url.split('?')[0] + "</i><br/>Contact your administrator for information.";
|
||||
|
||||
notificationsService.error("Authorization error", msg);
|
||||
}
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace Umbraco.Web.Components
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Notify(IAction action, params IUmbracoEntity[] entities)
|
||||
public void Notify(IAction action, params IContent[] entities)
|
||||
{
|
||||
IUser user = null;
|
||||
if (_umbracoContextAccessor.UmbracoContext != null)
|
||||
@@ -145,7 +145,7 @@ namespace Umbraco.Web.Components
|
||||
SendNotification(user, entities, action, _runtimeState.ApplicationUrl);
|
||||
}
|
||||
|
||||
private void SendNotification(IUser sender, IEnumerable<IUmbracoEntity> entities, IAction action, Uri siteUri)
|
||||
private void SendNotification(IUser sender, IEnumerable<IContent> entities, IAction action, Uri siteUri)
|
||||
{
|
||||
if (sender == null) throw new ArgumentNullException(nameof(sender));
|
||||
if (siteUri == null) throw new ArgumentNullException(nameof(siteUri));
|
||||
|
||||
Reference in New Issue
Block a user