public ActivityViewService(ViewServicePack services, ILogger <ActivityViewService> logger,
                            ActivityViewSource activity, WatchViewSource watchSource)
     : base(services, logger)
 {
     this.activity    = activity;
     this.watchSource = watchSource;
 }
 public WatchViewService(ViewServicePack services, ILogger <WatchViewService> logger, WatchViewSource converter,
                         ContentViewService contentService)
     : base(services, logger)
 {
     this.converter      = converter;
     this.contentService = contentService;
 }
        public async Task FixWatchLimits(WatchViewSource watchSource, Requester requester, IdLimiter limiter)
        {
            if (limiter.Watches)
            {
                if (requester.userId > 0)
                {
                    var watchSearch = new WatchSearch();
                    watchSearch.UserIds.Add(requester.userId);
                    watchSearch.Reverse = true;

                    limiter.Limit = (await watchSource.SimpleSearchAsync(watchSearch, q =>
                                                                         services.permissions.PermissionWhere(q, requester, Keys.ReadAction)))
                                    .Select(x => new IdLimit()
                    {
                        id = x.contentId, min = x.lastNotificationId
                    }).ToList();
                }

                // Just a silly thing to ensure "0" elements still means "no search" (although I hate that old
                // dicision... even though this one could easily be changed, consistency is better)
                limiter.Limit.Add(new IdLimit()
                {
                    id = long.MaxValue
                });
            }
        }
Beispiel #4
0
 public ActivityViewService(ViewServicePack services, ILogger <ActivityViewService> logger,
                            ActivityViewSource activity, /*CommentViewSource comments,*/ WatchViewSource watchSource)
     : base(services, logger)
 {
     this.activity = activity;
     //this.comments = comments;
     this.watchSource = watchSource;
 }
 public CommentViewService(ViewServicePack services, ILogger <CommentViewService> logger,
                           CommentViewSource converter, WatchViewSource watchSource, BanViewSource banSource,
                           ICodeTimer timer) : base(services, logger)
 {
     this.converter   = converter;
     this.watchSource = watchSource;
     this.timer       = timer;
     this.banSource   = banSource;
 }
 public CommentViewService(ViewServicePack services, ILogger <CommentViewService> logger,
                           CommentViewSource converter, WatchViewSource watchSource, BanViewSource banSource,
                           ContentViewSource contentSource, ICodeTimer timer, CacheService <long, CommentView> singlecache) : base(services, logger)
 {
     this.converter     = converter;
     this.watchSource   = watchSource;
     this.timer         = timer;
     this.banSource     = banSource;
     this.contentSource = contentSource;
     this.singlecache   = singlecache;
 }
Beispiel #7
0
 public ContentViewService(ViewServicePack services, ILogger <ContentViewService> logger,
                           CategoryViewSource categoryService, ContentViewSource converter,
                           CommentViewSource commentSource, WatchViewSource watchSource, VoteViewSource voteSource, BanViewSource banSource)
     : base(services, logger, converter, banSource)
 {
     this.categoryService = categoryService;
     this.commentSource   = commentSource;
     this.watchSource     = watchSource;
     this.contentSource   = converter;
     this.voteSource      = voteSource;
 }
 //WARN: uses the same cache as comments! if we get a lot of module room messages, they could push out the
 //comments, which are arguably more important!
 public ModuleRoomMessageViewService(ViewServicePack services, ILogger <CommentViewService> logger,
                                     ModuleRoomMessageViewSource converter, WatchViewSource watchSource, BanViewSource banSource,
                                     ContentViewSource contentSource, ICodeTimer timer, SpecialModuleCacheService singlecache) :
     base(services, logger, converter, watchSource, banSource, contentSource, timer, singlecache)
 {
 }