aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Notifications/InternalNotificationService.cs
blob: 56cb52f108b226b22a94737f04c9c16fc1143f8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Notifications;
using MediaBrowser.Model.Notifications;
using System.Threading;
using System.Threading.Tasks;

namespace MediaBrowser.Server.Implementations.Notifications
{
    public class InternalNotificationService : INotificationService
    {
        private readonly INotificationsRepository _repo;

        public InternalNotificationService(INotificationsRepository repo)
        {
            _repo = repo;
        }

        public string Name
        {
            get { return "Dashboard Notifications"; }
        }

        public Task SendNotification(UserNotification request, CancellationToken cancellationToken)
        {
            return _repo.AddNotification(new Notification
            {
                Date = request.Date,
                Description = request.Description,
                Level = request.Level,
                Name = request.Name,
                Url = request.Url,
                UserId = request.User.Id.ToString("N")

            }, cancellationToken);
        }

        public bool IsEnabledForUser(User user)
        {
            return true;
        }
    }
}