From f90cdbef16eab74f43622869b8294dc90b3fd12a Mon Sep 17 00:00:00 2001 From: RaidMax Date: Thu, 24 Mar 2022 16:23:40 -0500 Subject: [PATCH] fix meta filter on profile --- Application/Misc/MetaServiceV2.cs | 2 +- .../Controllers/Client/ClientController.cs | 4 ++-- .../ProfileMetaListViewComponent.cs | 24 +++++++++---------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Application/Misc/MetaServiceV2.cs b/Application/Misc/MetaServiceV2.cs index 8fb49bff5..2abb59934 100644 --- a/Application/Misc/MetaServiceV2.cs +++ b/Application/Misc/MetaServiceV2.cs @@ -439,7 +439,7 @@ public class MetaServiceV2 : IMetaServiceV2 return ProcessInformationMeta(allMeta); } - var meta = await _metaActions[metaType][0](request) as IEnumerable; + var meta = await _metaActions[metaType][0](request, token) as IEnumerable; return meta; } diff --git a/WebfrontCore/Controllers/Client/ClientController.cs b/WebfrontCore/Controllers/Client/ClientController.cs index 06d02d715..96f37ac39 100644 --- a/WebfrontCore/Controllers/Client/ClientController.cs +++ b/WebfrontCore/Controllers/Client/ClientController.cs @@ -191,7 +191,7 @@ namespace WebfrontCore.Controllers return View("Find/Index", clientsDto); } - public async Task Meta(int id, int count, int offset, long? startAt, MetaType? metaFilterType) + public async Task Meta(int id, int count, int offset, long? startAt, MetaType? metaFilterType, CancellationToken token) { var request = new ClientPaginationRequest { @@ -201,7 +201,7 @@ namespace WebfrontCore.Controllers Before = DateTime.FromFileTimeUtc(startAt ?? DateTime.UtcNow.ToFileTimeUtc()) }; - var meta = await ProfileMetaListViewComponent.GetClientMeta(_metaService, metaFilterType, Client.Level, request); + var meta = await ProfileMetaListViewComponent.GetClientMeta(_metaService, metaFilterType, Client.Level, request, token); if (!meta.Any()) { diff --git a/WebfrontCore/ViewComponents/ProfileMetaListViewComponent.cs b/WebfrontCore/ViewComponents/ProfileMetaListViewComponent.cs index e0fef24d2..f6a24358c 100644 --- a/WebfrontCore/ViewComponents/ProfileMetaListViewComponent.cs +++ b/WebfrontCore/ViewComponents/ProfileMetaListViewComponent.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Security.Claims; +using System.Threading; using System.Threading.Tasks; namespace WebfrontCore.ViewComponents @@ -20,7 +21,7 @@ namespace WebfrontCore.ViewComponents _metaService = metaService; } - public async Task InvokeAsync(int clientId, int count, int offset, DateTime? startAt, MetaType? metaType) + public async Task InvokeAsync(int clientId, int count, int offset, DateTime? startAt, MetaType? metaType, CancellationToken token) { var level = (EFClient.Permission)Enum.Parse(typeof(EFClient.Permission), UserClaimsPrincipal.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Role)?.Value ?? "User"); @@ -32,20 +33,20 @@ namespace WebfrontCore.ViewComponents Before = startAt, }; - var meta = await GetClientMeta(_metaService, metaType, level, request); + var meta = await GetClientMeta(_metaService, metaType, level, request, token); ViewBag.Localization = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex; return View("_List", meta); } public static async Task> GetClientMeta(IMetaServiceV2 metaService, MetaType? metaType, - EFClient.Permission level, ClientPaginationRequest request) + EFClient.Permission level, ClientPaginationRequest request, CancellationToken token) { IEnumerable meta = null; if (metaType is null or MetaType.All) { - meta = await metaService.GetRuntimeMeta(request); + meta = await metaService.GetRuntimeMeta(request, token); } else @@ -53,26 +54,25 @@ namespace WebfrontCore.ViewComponents switch (metaType) { case MetaType.Information: - meta = await metaService.GetRuntimeMeta(request, metaType.Value); + meta = await metaService.GetRuntimeMeta(request, metaType.Value, token); break; case MetaType.AliasUpdate: - meta = await metaService.GetRuntimeMeta(request, metaType.Value); + meta = await metaService.GetRuntimeMeta(request, metaType.Value, token); break; case MetaType.ChatMessage: - meta = await metaService.GetRuntimeMeta(request, metaType.Value); + meta = await metaService.GetRuntimeMeta(request, metaType.Value, token); break; case MetaType.Penalized: - meta = await metaService.GetRuntimeMeta(request, metaType.Value); + meta = await metaService.GetRuntimeMeta(request, metaType.Value, token); break; case MetaType.ReceivedPenalty: - meta = await metaService.GetRuntimeMeta(request, metaType.Value); + meta = await metaService.GetRuntimeMeta(request, metaType.Value, token); break; case MetaType.ConnectionHistory: - meta = await metaService.GetRuntimeMeta(request, metaType.Value); + meta = await metaService.GetRuntimeMeta(request, metaType.Value, token); break; case MetaType.PermissionLevel: - meta = await metaService.GetRuntimeMeta(request, - metaType.Value); + meta = await metaService.GetRuntimeMeta(request, metaType.Value, token); break; } }