Files
Umbraco-CMS/src/Umbraco.Core/Notifications/NotificationExtensions.cs
Andy Butland 96d33201aa Few more NRT tweaks (#12323)
* Amended GetAll() on IDataTypeService to return an empty collection rather than null.

* Added a ClearSessionValue method to ISessionManager (given you can no longer set a value to null).

* Allow for null values in a StatefulNotification.

* Removed obsoletion of synchronous messages on TreeControllerBase.

* Fixed further CS8620 warnings in core project.

* Further fix to nullable warning.

* Aligned nullablility of retreiving tree nodes and menus, synchronously or asynchronously (such that we no longer can get null values, always empty collection objects).
2022-05-01 08:18:09 +02:00

18 lines
583 B
C#

using System.Collections.Generic;
namespace Umbraco.Cms.Core.Notifications
{
public static class NotificationExtensions
{
public static T WithState<T>(this T notification, IDictionary<string, object?>? state) where T : IStatefulNotification
{
notification.State = state!;
return notification;
}
public static T WithStateFrom<T, TSource>(this T notification, TSource source)
where T : IStatefulNotification where TSource : IStatefulNotification
=> notification.WithState(source.State);
}
}