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-05-01 08:18:09 +02:00
|
|
|
public static T WithState<T>(this T notification, IDictionary<string, object?>? state) where T : IStatefulNotification
|
2021-03-08 11:01:14 +01:00
|
|
|
{
|
2022-02-28 13:14:02 +01:00
|
|
|
notification.State = state!;
|
2021-03-08 11:01:14 +01:00
|
|
|
return notification;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static T WithStateFrom<T, TSource>(this T notification, TSource source)
|
|
|
|
|
where T : IStatefulNotification where TSource : IStatefulNotification
|
|
|
|
|
=> notification.WithState(source.State);
|
|
|
|
|
}
|
|
|
|
|
}
|