Ejemplo n.º 1
0
        public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            if (commentsFeedNotificationTransport == null)
            {
                commentsFeedNotificationTransport = await feedRepo.GetCommentsFeedNotificationTransport();
            }

            var userId = User.GetUserId();
            await feedRepo.AddFeedNotificationTransportIfNeeded(userId);

            await next();
        }
Ejemplo n.º 2
0
        public NotificationsController(ILogger logger, WebCourseManager courseManager, UlearnDb db,
                                       IUsersRepo usersRepo,
                                       INotificationsRepo notificationsRepo, IFeedRepo feedRepo,
                                       IServiceProvider serviceProvider,
                                       INotificationDataPreloader notificationDataPreloader)
            : base(logger, courseManager, db, usersRepo)
        {
            this.notificationsRepo         = notificationsRepo ?? throw new ArgumentNullException(nameof(notificationsRepo));
            this.feedRepo                  = feedRepo ?? throw new ArgumentNullException(nameof(feedRepo));
            this.serviceProvider           = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
            this.notificationDataPreloader = notificationDataPreloader ?? throw new ArgumentNullException(nameof(notificationDataPreloader));

            if (commentsFeedNotificationTransport == null)
            {
                commentsFeedNotificationTransport = feedRepo.GetCommentsFeedNotificationTransport();
            }
        }