From afab347c8ed161aecaea8b179060c758b979725b Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Sun, 14 Feb 2021 20:19:31 +0330 Subject: [PATCH] #75 fixes --- RMuseum/RMuseum.xml | 8 +++++++- .../Services/Implementation/GanjoorService.cs | 20 ++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml index ad44357b..e8448252 100644 --- a/RMuseum/RMuseum.xml +++ b/RMuseum/RMuseum.xml @@ -6981,13 +6981,19 @@ Background Task Queue Instance - + + + IAppUserService instance + + + constructor + diff --git a/RMuseum/Services/Implementation/GanjoorService.cs b/RMuseum/Services/Implementation/GanjoorService.cs index 54dd5f83..39d913a0 100644 --- a/RMuseum/Services/Implementation/GanjoorService.cs +++ b/RMuseum/Services/Implementation/GanjoorService.cs @@ -550,12 +550,19 @@ namespace RMuseum.Services.Implementation _context.GanjoorComments.Add(comment); await _context.SaveChangesAsync(); + var userRes = await _appUserService.GetUserInformation(userId); + + comment.HtmlComment = comment.HtmlComment.ToPersianNumbers().ApplyCorrectYeKe(); + comment.HtmlComment = _Linkify(comment.HtmlComment); + comment.HtmlComment = $"

{comment.HtmlComment.Replace("\r\n", "\n").Replace("\n\n", "\n").Replace("\n", "
")}

"; + + return new RServiceResult ( new GanjoorCommentSummaryViewModel() { Id = comment.Id, - AuthorName = $"{comment.User.FirstName} {comment.User.SureName}".Trim(), + AuthorName = $"{userRes.Result.FirstName} {userRes.Result.SureName}".Trim(), AuthorUrl = comment.AuthorUrl, CommentDate = comment.CommentDate, HtmlComment = comment.HtmlComment, @@ -1304,18 +1311,25 @@ namespace RMuseum.Services.Implementation ///
protected readonly IBackgroundTaskQueue _backgroundTaskQueue; + /// + /// IAppUserService instance + /// + protected IAppUserService _appUserService; + + - /// /// constructor /// /// /// /// - public GanjoorService(RMuseumDbContext context, IConfiguration configuration, IBackgroundTaskQueue backgroundTaskQueue) + /// + public GanjoorService(RMuseumDbContext context, IConfiguration configuration, IBackgroundTaskQueue backgroundTaskQueue, IAppUserService appUserService) { _context = context; _backgroundTaskQueue = backgroundTaskQueue; + _appUserService = appUserService; Configuration = configuration; } }