Skip to content

Commit

Permalink
fix a covered exception
Browse files Browse the repository at this point in the history
  • Loading branch information
EdiWang committed May 23, 2024
1 parent 5f4ea1b commit c4c903a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/Moonglade.Core/PostFeature/UpdatePostCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,18 @@ public async Task<PostEntity> Handle(UpdatePostCommand request, CancellationToke

post.CommentEnabled = postEditModel.EnableComment;
post.PostContent = postEditModel.EditorContent;
post.ContentAbstract = ContentProcessor.GetPostAbstract(
string.IsNullOrEmpty(postEditModel.Abstract) ? postEditModel.EditorContent : postEditModel.Abstract.Trim(),
_blogConfig.ContentSettings.PostAbstractWords,
_configuration.GetSection("Editor").Get<EditorChoice>() == EditorChoice.Markdown);

if (string.IsNullOrEmpty(postEditModel.Abstract))
{
post.ContentAbstract = ContentProcessor.GetPostAbstract(
postEditModel.EditorContent,
_blogConfig.ContentSettings.PostAbstractWords,
_configuration.GetSection("Editor").Get<EditorChoice>() == EditorChoice.Markdown);
}
else
{
post.ContentAbstract = postEditModel.Abstract.Trim();
}

if (postEditModel.IsPublished && !post.IsPublished)
{
Expand Down

0 comments on commit c4c903a

Please sign in to comment.