public async Task <IActionResult> OnGetAsync(string id) { Id = id; Comments = await _commentsManager.GetReviewCommentsAsync(id); return(Page()); }
private int ComputeActiveConversations(CodeLine[] lines, ReviewCommentsModel comments) { int activeThreads = 0; foreach (CodeLine line in lines) { if (string.IsNullOrEmpty(line.ElementId)) { continue; } // if we have comments for this line and the thread has not been resolved. if (comments.TryGetThreadForLine(line.ElementId, out CommentThreadModel thread) && !thread.IsResolved) { activeThreads++; } } return(activeThreads); }
private CodeLineModel[] CreateLines(CodeDiagnostic[] diagnostics, CodeLine[] lines, ReviewCommentsModel comments) { return(lines.Select( line => new CodeLineModel( DiffLineKind.Unchanged, line, comments.TryGetThreadForLine(line.ElementId, out var thread) ? thread : null, diagnostics.Where(d => d.TargetId == line.ElementId).ToArray() )).ToArray()); }
private CodeLineModel[] CreateLines(CodeDiagnostic[] diagnostics, InlineDiffLine <CodeLine>[] lines, ReviewCommentsModel comments) { return(lines.Select( diffLine => new CodeLineModel( diffLine.Kind, diffLine.Line, diffLine.Kind != DiffLineKind.Removed && comments.TryGetThreadForLine(diffLine.Line.ElementId, out var thread) ? thread : null, diffLine.Kind != DiffLineKind.Removed ? diagnostics.Where(d => d.TargetId == diffLine.Line.ElementId).ToArray() : Array.Empty <CodeDiagnostic>() )).ToArray()); }