|
|
|
@ -1,22 +1,21 @@
|
|
|
|
|
using System;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
|
using Volo.Abp;
|
|
|
|
|
using Volo.Abp.Application.Dtos;
|
|
|
|
|
using Volo.Abp.Application.Services;
|
|
|
|
|
using Volo.Abp.Authorization;
|
|
|
|
|
using Volo.Abp.EventBus.Distributed;
|
|
|
|
|
using Volo.Abp.Uow;
|
|
|
|
|
using Volo.Abp.GlobalFeatures;
|
|
|
|
|
using Volo.Abp.Users;
|
|
|
|
|
using Volo.CmsKit.Comments;
|
|
|
|
|
using Volo.CmsKit.GlobalFeatures;
|
|
|
|
|
using Volo.CmsKit.Users;
|
|
|
|
|
|
|
|
|
|
namespace Volo.CmsKit.Public.Comments
|
|
|
|
|
{
|
|
|
|
|
public class CommentPublicAppService : ApplicationService, ICommentPublicAppService
|
|
|
|
|
[RequiresGlobalFeature(typeof(CommentsFeature))]
|
|
|
|
|
public class CommentPublicAppService : CmsKitPublicAppServiceBase, ICommentPublicAppService
|
|
|
|
|
{
|
|
|
|
|
protected ICommentRepository CommentRepository { get; }
|
|
|
|
|
protected ICmsUserLookupService CmsUserLookupService { get; }
|
|
|
|
@ -50,7 +49,7 @@ namespace Volo.CmsKit.Public.Comments
|
|
|
|
|
{
|
|
|
|
|
var user = await CmsUserLookupService.GetByIdAsync(CurrentUser.GetId());
|
|
|
|
|
|
|
|
|
|
if(input.RepliedCommentId.HasValue)
|
|
|
|
|
if (input.RepliedCommentId.HasValue)
|
|
|
|
|
{
|
|
|
|
|
await CommentRepository.GetAsync(input.RepliedCommentId.Value);
|
|
|
|
|
}
|
|
|
|
@ -111,8 +110,8 @@ namespace Volo.CmsKit.Public.Comments
|
|
|
|
|
//TODO: I think this method can be optimized if you use dictionaries instead of straight search
|
|
|
|
|
|
|
|
|
|
var parentComments = comments
|
|
|
|
|
.Where(c=> c.Comment.RepliedCommentId == null)
|
|
|
|
|
.Select(c=> ObjectMapper.Map<Comment, CommentWithDetailsDto>(c.Comment))
|
|
|
|
|
.Where(c => c.Comment.RepliedCommentId == null)
|
|
|
|
|
.Select(c => ObjectMapper.Map<Comment, CommentWithDetailsDto>(c.Comment))
|
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
foreach (var parentComment in parentComments)
|
|
|
|
|