public static ReviewCommentResponse Build(ExerciseCodeReviewComment comment)
 {
     return(new ReviewCommentResponse
     {
         Id = comment.Id,
         Text = comment.Text,
         RenderedText = CommentTextHelper.RenderCommentTextToHtml(comment.Text),
         PublishTime = comment.AddingTime,
         Author = BaseController.BuildShortUserInfo(comment.Author)
     });
 }
示例#2
0
 public static ReviewInfo Build(ExerciseCodeReview r, [CanBeNull] IEnumerable <ExerciseCodeReviewComment> comments, bool isUlearnBot)
 {
     return(new ReviewInfo
     {
         Id = r.Id,
         Comment = r.Comment,
         RenderedComment = CommentTextHelper.RenderCommentTextToHtml(r.Comment),
         Author = isUlearnBot ? null : BaseController.BuildShortUserInfo(r.Author),
         AddingTime = isUlearnBot || r.AddingTime <= DateTime.UnixEpoch ? (DateTime?)null : r.AddingTime,
         FinishLine = r.FinishLine,
         FinishPosition = r.FinishPosition,
         StartLine = r.StartLine,
         StartPosition = r.StartPosition,
         Comments = comments
                    .EmptyIfNull()
                    .OrderBy(c => c.AddingTime)
                    .Select(ReviewCommentResponse.Build)
                    .ToList()
     });
 }