|
|
|
@ -60,8 +60,9 @@ public class CommentingViewComponent : AbpViewComponent |
|
|
|
public virtual async Task<IViewComponentResult> InvokeAsync( |
|
|
|
string entityType, |
|
|
|
string entityId, |
|
|
|
IEnumerable<string> rels = null) |
|
|
|
IEnumerable<string> referralLinks = null) |
|
|
|
{ |
|
|
|
referralLinks ??= Enumerable.Empty<string>(); |
|
|
|
var comments = (await CommentPublicAppService |
|
|
|
.GetListAsync(entityType, entityId)).Items; |
|
|
|
|
|
|
|
@ -71,7 +72,7 @@ public class CommentingViewComponent : AbpViewComponent |
|
|
|
{ |
|
|
|
EntityId = entityId, |
|
|
|
EntityType = entityType, |
|
|
|
Rels = rels, |
|
|
|
ReferralLinks = referralLinks, |
|
|
|
LoginUrl = loginUrl, |
|
|
|
Comments = comments.OrderByDescending(i => i.CreationTime).ToList() |
|
|
|
}; |
|
|
|
@ -100,12 +101,12 @@ public class CommentingViewComponent : AbpViewComponent |
|
|
|
private async Task ConvertMarkdownTextsToHtml(CommentingViewModel viewModel) |
|
|
|
{ |
|
|
|
viewModel.RawCommentTexts = new Dictionary<Guid, string>(); |
|
|
|
var rels = viewModel.Rels?.ToArray(); |
|
|
|
var referralLinks = viewModel.ReferralLinks?.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, rels: rels); |
|
|
|
comment.Text = await MarkdownToHtmlRenderer.RenderAsync(comment.Text, allowHtmlTags: false, preventXSS: true, referralLinks: referralLinks.JoinAsString(" ")); |
|
|
|
|
|
|
|
foreach (var reply in comment.Replies) |
|
|
|
{ |
|
|
|
@ -121,7 +122,7 @@ public class CommentingViewComponent : AbpViewComponent |
|
|
|
|
|
|
|
public string EntityId { get; set; } |
|
|
|
|
|
|
|
public IEnumerable<string> Rels { get; set; } |
|
|
|
public IEnumerable<string> ReferralLinks { get; set; } |
|
|
|
|
|
|
|
public string LoginUrl { get; set; } |
|
|
|
|
|
|
|
|