fix meta filter on profile
This commit is contained in:
parent
a863f78678
commit
f90cdbef16
@ -439,7 +439,7 @@ public class MetaServiceV2 : IMetaServiceV2
|
|||||||
return ProcessInformationMeta(allMeta);
|
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;
|
return meta;
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ namespace WebfrontCore.Controllers
|
|||||||
return View("Find/Index", clientsDto);
|
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
|
var request = new ClientPaginationRequest
|
||||||
{
|
{
|
||||||
@ -201,7 +201,7 @@ namespace WebfrontCore.Controllers
|
|||||||
Before = DateTime.FromFileTimeUtc(startAt ?? DateTime.UtcNow.ToFileTimeUtc())
|
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())
|
if (!meta.Any())
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace WebfrontCore.ViewComponents
|
namespace WebfrontCore.ViewComponents
|
||||||
@ -20,7 +21,7 @@ namespace WebfrontCore.ViewComponents
|
|||||||
_metaService = metaService;
|
_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");
|
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,
|
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;
|
ViewBag.Localization = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex;
|
||||||
|
|
||||||
return View("_List", meta);
|
return View("_List", meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<IEnumerable<IClientMeta>> GetClientMeta(IMetaServiceV2 metaService, MetaType? metaType,
|
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;
|
IEnumerable<IClientMeta> meta = null;
|
||||||
|
|
||||||
if (metaType is null or MetaType.All)
|
if (metaType is null or MetaType.All)
|
||||||
{
|
{
|
||||||
meta = await metaService.GetRuntimeMeta(request);
|
meta = await metaService.GetRuntimeMeta(request, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -53,26 +54,25 @@ namespace WebfrontCore.ViewComponents
|
|||||||
switch (metaType)
|
switch (metaType)
|
||||||
{
|
{
|
||||||
case MetaType.Information:
|
case MetaType.Information:
|
||||||
meta = await metaService.GetRuntimeMeta<InformationResponse>(request, metaType.Value);
|
meta = await metaService.GetRuntimeMeta<InformationResponse>(request, metaType.Value, token);
|
||||||
break;
|
break;
|
||||||
case MetaType.AliasUpdate:
|
case MetaType.AliasUpdate:
|
||||||
meta = await metaService.GetRuntimeMeta<UpdatedAliasResponse>(request, metaType.Value);
|
meta = await metaService.GetRuntimeMeta<UpdatedAliasResponse>(request, metaType.Value, token);
|
||||||
break;
|
break;
|
||||||
case MetaType.ChatMessage:
|
case MetaType.ChatMessage:
|
||||||
meta = await metaService.GetRuntimeMeta<MessageResponse>(request, metaType.Value);
|
meta = await metaService.GetRuntimeMeta<MessageResponse>(request, metaType.Value, token);
|
||||||
break;
|
break;
|
||||||
case MetaType.Penalized:
|
case MetaType.Penalized:
|
||||||
meta = await metaService.GetRuntimeMeta<AdministeredPenaltyResponse>(request, metaType.Value);
|
meta = await metaService.GetRuntimeMeta<AdministeredPenaltyResponse>(request, metaType.Value, token);
|
||||||
break;
|
break;
|
||||||
case MetaType.ReceivedPenalty:
|
case MetaType.ReceivedPenalty:
|
||||||
meta = await metaService.GetRuntimeMeta<ReceivedPenaltyResponse>(request, metaType.Value);
|
meta = await metaService.GetRuntimeMeta<ReceivedPenaltyResponse>(request, metaType.Value, token);
|
||||||
break;
|
break;
|
||||||
case MetaType.ConnectionHistory:
|
case MetaType.ConnectionHistory:
|
||||||
meta = await metaService.GetRuntimeMeta<ConnectionHistoryResponse>(request, metaType.Value);
|
meta = await metaService.GetRuntimeMeta<ConnectionHistoryResponse>(request, metaType.Value, token);
|
||||||
break;
|
break;
|
||||||
case MetaType.PermissionLevel:
|
case MetaType.PermissionLevel:
|
||||||
meta = await metaService.GetRuntimeMeta<PermissionLevelChangedResponse>(request,
|
meta = await metaService.GetRuntimeMeta<PermissionLevelChangedResponse>(request, metaType.Value, token);
|
||||||
metaType.Value);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user