fix meta filter on profile

This commit is contained in:
RaidMax 2022-03-24 16:23:40 -05:00
parent a863f78678
commit f90cdbef16
3 changed files with 15 additions and 15 deletions

View File

@ -439,7 +439,7 @@ public class MetaServiceV2 : IMetaServiceV2
return ProcessInformationMeta(allMeta);
}
var meta = await _metaActions[metaType][0](request) as IEnumerable<T>;
var meta = await _metaActions[metaType][0](request, token) as IEnumerable<T>;
return meta;
}

View File

@ -191,7 +191,7 @@ namespace WebfrontCore.Controllers
return View("Find/Index", clientsDto);
}
public async Task<IActionResult> Meta(int id, int count, int offset, long? startAt, MetaType? metaFilterType)
public async Task<IActionResult> 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())
{

View File

@ -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<IViewComponentResult> InvokeAsync(int clientId, int count, int offset, DateTime? startAt, MetaType? metaType)
public async Task<IViewComponentResult> 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<IEnumerable<IClientMeta>> GetClientMeta(IMetaServiceV2 metaService, MetaType? metaType,
EFClient.Permission level, ClientPaginationRequest request)
EFClient.Permission level, ClientPaginationRequest request, CancellationToken token)
{
IEnumerable<IClientMeta> 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<InformationResponse>(request, metaType.Value);
meta = await metaService.GetRuntimeMeta<InformationResponse>(request, metaType.Value, token);
break;
case MetaType.AliasUpdate:
meta = await metaService.GetRuntimeMeta<UpdatedAliasResponse>(request, metaType.Value);
meta = await metaService.GetRuntimeMeta<UpdatedAliasResponse>(request, metaType.Value, token);
break;
case MetaType.ChatMessage:
meta = await metaService.GetRuntimeMeta<MessageResponse>(request, metaType.Value);
meta = await metaService.GetRuntimeMeta<MessageResponse>(request, metaType.Value, token);
break;
case MetaType.Penalized:
meta = await metaService.GetRuntimeMeta<AdministeredPenaltyResponse>(request, metaType.Value);
meta = await metaService.GetRuntimeMeta<AdministeredPenaltyResponse>(request, metaType.Value, token);
break;
case MetaType.ReceivedPenalty:
meta = await metaService.GetRuntimeMeta<ReceivedPenaltyResponse>(request, metaType.Value);
meta = await metaService.GetRuntimeMeta<ReceivedPenaltyResponse>(request, metaType.Value, token);
break;
case MetaType.ConnectionHistory:
meta = await metaService.GetRuntimeMeta<ConnectionHistoryResponse>(request, metaType.Value);
meta = await metaService.GetRuntimeMeta<ConnectionHistoryResponse>(request, metaType.Value, token);
break;
case MetaType.PermissionLevel:
meta = await metaService.GetRuntimeMeta<PermissionLevelChangedResponse>(request,
metaType.Value);
meta = await metaService.GetRuntimeMeta<PermissionLevelChangedResponse>(request, metaType.Value, token);
break;
}
}