InternalNotificationService.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using MediaBrowser.Controller.Entities;
  2. using MediaBrowser.Controller.Notifications;
  3. using MediaBrowser.Model.Notifications;
  4. using System.Threading;
  5. using System.Threading.Tasks;
  6. namespace MediaBrowser.Server.Implementations.Notifications
  7. {
  8. public class InternalNotificationService : INotificationService
  9. {
  10. private readonly INotificationsRepository _repo;
  11. public InternalNotificationService(INotificationsRepository repo)
  12. {
  13. _repo = repo;
  14. }
  15. public string Name
  16. {
  17. get { return "Dashboard Notifications"; }
  18. }
  19. public Task SendNotification(UserNotification request, CancellationToken cancellationToken)
  20. {
  21. return _repo.AddNotification(new Notification
  22. {
  23. Date = request.Date,
  24. Description = request.Description,
  25. Level = request.Level,
  26. Name = request.Name,
  27. Url = request.Url,
  28. UserId = request.User.Id.ToString("N")
  29. }, cancellationToken);
  30. }
  31. public bool IsEnabledForUser(User user)
  32. {
  33. return true;
  34. }
  35. }
  36. }