Remove static tags logic

pull/6850/head
enisn 5 years ago
parent 0d9880eb8a
commit 49f3b6a8f4

@ -22,8 +22,7 @@
@await Component.InvokeAsync(typeof(TagViewComponent), new
{
entityType = "quote",
entityId = "1",
tags = new List<string> { "a", "b" }
entityId = "1"
})
</abp-blockquote>
@ -89,8 +88,7 @@
@await Component.InvokeAsync(typeof(TagViewComponent), new
{
entityType = "IndexPage",
entityId = Guid.Empty.ToString(),
tags = new List<string> { "a", "b" }
entityId = Guid.Empty.ToString()
})
</abp-column>
</abp-row>

@ -10,7 +10,5 @@ namespace Volo.CmsKit.Tags
[Required]
public string EntityId { get; set; }
public List<string> Tags { get; set; }
}
}

@ -13,7 +13,8 @@ namespace Volo.CmsKit.Tags
public TagAppService(
ITagManager tagManager,
ITagRepository tagRepository, IEntityTagRepository entityTagRepository)
ITagRepository tagRepository,
IEntityTagRepository entityTagRepository)
{
TagManager = tagManager;
TagRepository = tagRepository;
@ -27,31 +28,6 @@ namespace Volo.CmsKit.Tags
input.EntityId,
CurrentTenant.Id);
if (input.Tags?.Count > 0)
{
var nonExisting = input.Tags
.Where(x =>
!entities.Any(a =>
a.Name.Equals(x.Trim(),
StringComparison.InvariantCultureIgnoreCase)));
foreach (var tag in nonExisting)
{
var insertedTag = await TagManager.GetOrAddAsync(
input.EntityType,
tag,
tenantId: CurrentTenant?.Id);
await EntityTagRepository.InsertAsync(
new EntityTag(
insertedTag.Id,
input.EntityId,
CurrentTenant?.Id));
entities.Add(insertedTag);
}
}
return ObjectMapper.Map<List<Tag>, List<TagDto>>(entities);
}
}

@ -21,14 +21,12 @@ namespace Volo.CmsKit.Web.Pages.CmsKit.Shared.Components.Tags
public virtual async Task<IViewComponentResult> InvokeAsync(
string entityType,
string entityId,
IEnumerable<string> tags = null)
string entityId)
{
var tagDtos = await TagAppService.GetAllRelatedTagsAsync(new GetRelatedTagsInput
{
EntityId = entityId,
EntityType = entityType,
Tags = tags?.ToList()
EntityType = entityType
});
var viewModel = new TagViewModel

Loading…
Cancel
Save