示例#1
0
 private async Task CheckForSubscription(HideResult shouldHide, List <TvRequests> x)
 {
     foreach (var tvRequest in x)
     {
         await CheckForSubscription(shouldHide, tvRequest.ChildRequests);
     }
 }
示例#2
0
 private async Task CheckForSubscription(HideResult shouldHide, TvRequests x)
 {
     foreach (var tv in x.ChildRequests)
     {
         await CheckForSubscription(shouldHide, tv);
     }
 }
示例#3
0
 private static void FilterChildren(IEnumerable <TvRequests> allRequests, HideResult shouldHide)
 {
     // Filter out children
     foreach (var t in allRequests)
     {
         for (var j = 0; j < t.ChildRequests.Count; j++)
         {
             FilterChildren(t, shouldHide);
         }
     }
 }
示例#4
0
        private static void FilterChildren(List <ChildRequests> t, HideResult shouldHide)
        {
            // Filter out children

            for (var j = 0; j < t.Count; j++)
            {
                var child = t[j];
                if (child.RequestedUserId != shouldHide.UserId)
                {
                    t.RemoveAt(j);
                    j--;
                }
            }
        }
示例#5
0
        private async Task CheckForSubscription(HideResult shouldHide, AlbumRequest x)
        {
            if (shouldHide.UserId == x.RequestedUserId)
            {
                x.ShowSubscribe = false;
            }
            else
            {
                x.ShowSubscribe = true;
                var sub = await _subscriptionRepository.GetAll().FirstOrDefaultAsync(s =>
                                                                                     s.UserId == shouldHide.UserId && s.RequestId == x.Id && s.RequestType == RequestType.Album);

                x.Subscribed = sub != null;
            }
        }
示例#6
0
 private static void FilterChildren(IEnumerable <TvRequests> allRequests, HideResult shouldHide)
 {
     // Filter out children
     foreach (var t in allRequests)
     {
         for (var j = 0; j < t.ChildRequests.Count; j++)
         {
             var child = t.ChildRequests[j];
             if (child.RequestedUserId != shouldHide.UserId)
             {
                 t.ChildRequests.RemoveAt(j);
                 j--;
             }
         }
     }
 }
示例#7
0
        private async Task CheckForSubscription(HideResult shouldHide, List <ChildRequests> childRequests)
        {
            var sub          = _subscriptionRepository.GetAll();
            var childIds     = childRequests.Select(x => x.Id);
            var relevantSubs = await sub.Where(s =>
                                               s.UserId == shouldHide.UserId && childIds.Contains(s.Id) && s.RequestType == RequestType.TvShow).ToListAsync();

            foreach (var x in childRequests)
            {
                if (shouldHide.UserId == x.RequestedUserId)
                {
                    x.ShowSubscribe = false;
                }
                else
                {
                    x.ShowSubscribe = true;
                    var result = relevantSubs.FirstOrDefault(s => s.RequestId == x.Id);
                    x.Subscribed = result != null;
                }
            }
        }
示例#8
0
        private async Task CheckForSubscription(HideResult shouldHide, List <AlbumRequest> albumRequests)
        {
            var requestIds = albumRequests.Select(x => x.Id);
            var sub        = await _subscriptionRepository.GetAll().Where(s =>
                                                                          s.UserId == shouldHide.UserId && requestIds.Contains(s.RequestId) && s.RequestType == RequestType.Movie)
                             .ToListAsync();

            foreach (var x in albumRequests)
            {
                if (shouldHide.UserId == x.RequestedUserId)
                {
                    x.ShowSubscribe = false;
                }
                else
                {
                    x.ShowSubscribe = true;
                    var hasSub = sub.FirstOrDefault(r => r.RequestId == x.Id);
                    x.Subscribed = hasSub != null;
                }
            }
        }
示例#9
0
        protected async Task <HideResult> HideFromOtherUsers()
        {
            var user = await GetUser();

            if (await IsInRole(OmbiRoles.Admin) || await IsInRole(OmbiRoles.PowerUser) || user.IsSystemUser)
            {
                return(new HideResult
                {
                    UserId = user.Id
                });
            }
            var settings = await Cache.GetOrAdd(CacheKeys.OmbiSettings, async() => await OmbiSettings.GetSettingsAsync());

            var result = new HideResult
            {
                Hide   = settings.HideRequestsUsers,
                UserId = user.Id
            };

            return(result);
        }
示例#10
0
 private static void FilterChildren(TvRequests t, HideResult shouldHide)
 {
     // Filter out children
     FilterChildren(t.ChildRequests, shouldHide);
 }
示例#11
0
 private void GoToButton_Click(object sender, RoutedEventArgs e)
 {
     NavigationPage.instance.NavigateTo(typeof(ChannelFeedbackPage), _foundChannel);
     HideResult.Begin();
 }