This commit is contained in:
Hamid Reza Mohammadi 2021-02-14 20:19:31 +03:30
parent 849b30c114
commit afab347c8e
2 changed files with 24 additions and 4 deletions

View File

@ -6981,13 +6981,19 @@
Background Task Queue Instance
</summary>
</member>
<member name="M:RMuseum.Services.Implementation.GanjoorService.#ctor(RMuseum.DbContext.RMuseumDbContext,Microsoft.Extensions.Configuration.IConfiguration,RSecurityBackend.Services.IBackgroundTaskQueue)">
<member name="F:RMuseum.Services.Implementation.GanjoorService._appUserService">
<summary>
IAppUserService instance
</summary>
</member>
<member name="M:RMuseum.Services.Implementation.GanjoorService.#ctor(RMuseum.DbContext.RMuseumDbContext,Microsoft.Extensions.Configuration.IConfiguration,RSecurityBackend.Services.IBackgroundTaskQueue,RSecurityBackend.Services.IAppUserService)">
<summary>
constructor
</summary>
<param name="context"></param>
<param name="configuration"></param>
<param name="backgroundTaskQueue"></param>
<param name="appUserService"></param>
</member>
<member name="T:RMuseum.Services.Implementation.ImportedFromDesktopGanjoor.GPersianTextSync">
<summary>

View File

@ -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 = $"<p>{comment.HtmlComment.Replace("\r\n", "\n").Replace("\n\n", "\n").Replace("\n", "<br />")}</p>";
return new RServiceResult<GanjoorCommentSummaryViewModel>
(
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
/// </summary>
protected readonly IBackgroundTaskQueue _backgroundTaskQueue;
/// <summary>
/// IAppUserService instance
/// </summary>
protected IAppUserService _appUserService;
/// <summary>
/// constructor
/// </summary>
/// <param name="context"></param>
/// <param name="configuration"></param>
/// <param name="backgroundTaskQueue"></param>
public GanjoorService(RMuseumDbContext context, IConfiguration configuration, IBackgroundTaskQueue backgroundTaskQueue)
/// <param name="appUserService"></param>
public GanjoorService(RMuseumDbContext context, IConfiguration configuration, IBackgroundTaskQueue backgroundTaskQueue, IAppUserService appUserService)
{
_context = context;
_backgroundTaskQueue = backgroundTaskQueue;
_appUserService = appUserService;
Configuration = configuration;
}
}