|
|
|
@ -59,7 +59,8 @@ public class CommentingViewComponent : AbpViewComponent |
|
|
|
|
|
|
|
public virtual async Task<IViewComponentResult> InvokeAsync( |
|
|
|
string entityType, |
|
|
|
string entityId) |
|
|
|
string entityId, |
|
|
|
IEnumerable<string> rels = null) |
|
|
|
{ |
|
|
|
var comments = (await CommentPublicAppService |
|
|
|
.GetListAsync(entityType, entityId)).Items; |
|
|
|
@ -70,6 +71,7 @@ public class CommentingViewComponent : AbpViewComponent |
|
|
|
{ |
|
|
|
EntityId = entityId, |
|
|
|
EntityType = entityType, |
|
|
|
Rels = rels, |
|
|
|
LoginUrl = loginUrl, |
|
|
|
Comments = comments.OrderByDescending(i => i.CreationTime).ToList() |
|
|
|
}; |
|
|
|
@ -98,11 +100,12 @@ public class CommentingViewComponent : AbpViewComponent |
|
|
|
private async Task ConvertMarkdownTextsToHtml(CommentingViewModel viewModel) |
|
|
|
{ |
|
|
|
viewModel.RawCommentTexts = new Dictionary<Guid, string>(); |
|
|
|
var rels = viewModel.Rels?.ToArray(); |
|
|
|
|
|
|
|
foreach (var comment in viewModel.Comments) |
|
|
|
{ |
|
|
|
viewModel.RawCommentTexts.Add(comment.Id, comment.Text); |
|
|
|
comment.Text = await MarkdownToHtmlRenderer.RenderAsync(comment.Text, allowHtmlTags: false, preventXSS: true); |
|
|
|
comment.Text = await MarkdownToHtmlRenderer.RenderAsync(comment.Text, allowHtmlTags: false, preventXSS: true, rels: rels); |
|
|
|
|
|
|
|
foreach (var reply in comment.Replies) |
|
|
|
{ |
|
|
|
@ -117,6 +120,8 @@ public class CommentingViewComponent : AbpViewComponent |
|
|
|
public string EntityType { get; set; } |
|
|
|
|
|
|
|
public string EntityId { get; set; } |
|
|
|
|
|
|
|
public IEnumerable<string> Rels { get; set; } |
|
|
|
|
|
|
|
public string LoginUrl { get; set; } |
|
|
|
|
|
|
|
|