2021-03-08 11:01:14 +01:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
2021-05-11 14:33:49 +02:00
|
|
|
namespace Umbraco.Cms.Core.Notifications
|
2021-03-08 11:01:14 +01:00
|
|
|
{
|
|
|
|
|
public static class NotificationExtensions
|
|
|
|
|
{
|
2022-02-16 16:03:53 +01:00
|
|
|
public static T WithState<T>(this T notification, IDictionary<string, object>? state) where T : IStatefulNotification
|
2021-03-08 11:01:14 +01:00
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|