private async Task <ActionResult> CommentPartialAsync(string reviewId, string elementId) { var comments = await _commentsManager.GetReviewCommentsAsync(reviewId); comments.TryGetThreadForLine(elementId, out var partialModel); return(PartialView("_CommentThreadPartial", partialModel)); }
public async Task <IActionResult> OnGetAsync(string id) { Id = id; Comments = await _commentsManager.GetReviewCommentsAsync(id); return(Page()); }
public async Task <IActionResult> OnGetAsync(string id, string revisionId = null) { TempData["Page"] = "api"; Review = await _manager.GetReviewAsync(User, id); if (!Review.Revisions.Any()) { return(RedirectToPage("LegacyReview", new { id = id })); } Revision = revisionId != null? Review.Revisions.Single(r => r.RevisionId == revisionId) : Review.Revisions.Last(); var reviewFile = Revision.Files.Single(); CodeFile = await _codeFileRepository.GetCodeFileAsync(Revision.RevisionId, reviewFile.ReviewFileId); Lines = new CodeFileHtmlRenderer().Render(CodeFile).ToArray(); Comments = await _commentsManager.GetReviewCommentsAsync(id); ActiveConversations = ComputeActiveConversations(Lines, Comments); TotalActiveConversations = Comments.Threads.Count(t => !t.IsResolved); return(Page()); }
public async Task <IActionResult> OnGetAsync(string id, string revisionId = null) { TempData["Page"] = "api"; Review = await _manager.GetReviewAsync(User, id); if (!Review.Revisions.Any()) { return(RedirectToPage("LegacyReview", new { id = id })); } Comments = await _commentsManager.GetReviewCommentsAsync(id); Revision = revisionId != null? Review.Revisions.Single(r => r.RevisionId == revisionId) : Review.Revisions.Last(); PreviousRevisions = Review.Revisions.TakeWhile(r => r != Revision).ToArray(); var renderedCodeFile = await _codeFileRepository.GetCodeFileAsync(Revision); CodeFile = renderedCodeFile.CodeFile; var fileDiagnostics = CodeFile.Diagnostics ?? Array.Empty <CodeDiagnostic>(); var fileHtmlLines = renderedCodeFile.Render(ShowDocumentation); if (DiffRevisionId != null) { DiffRevision = PreviousRevisions.Single(r => r.RevisionId == DiffRevisionId); var previousRevisionFile = await _codeFileRepository.GetCodeFileAsync(DiffRevision); var previousHtmlLines = previousRevisionFile.RenderReadOnly(ShowDocumentation); var previousRevisionTextLines = previousRevisionFile.RenderText(ShowDocumentation); var fileTextLines = renderedCodeFile.RenderText(ShowDocumentation); var diffLines = InlineDiff.Compute( previousRevisionTextLines, fileTextLines, previousHtmlLines, fileHtmlLines); Lines = CreateLines(fileDiagnostics, diffLines, Comments); } else { Lines = CreateLines(fileDiagnostics, fileHtmlLines, Comments); } ActiveConversations = ComputeActiveConversations(fileHtmlLines, Comments); TotalActiveConversations = Comments.Threads.Count(t => !t.IsResolved); var filterPreference = _preferenceCache.GetFilterType(User.GetGitHubLogin(), Review.FilterType); ReviewsForPackage = await _manager.GetReviewsAsync(Review.ServiceName, Review.PackageDisplayName, filterPreference); return(Page()); }
public async Task <IActionResult> OnGetAsync(string id) { TempData["Page"] = "conversation"; Review = await _reviewManager.GetReviewAsync(User, id); var comments = await _commentsManager.GetReviewCommentsAsync(id); Threads = ParseThreads(comments.Threads); return(Page()); }
public async Task <IActionResult> OnGetAsync(string id, string revisionId = null) { TempData["Page"] = "api"; Review = await _manager.GetReviewAsync(User, id); if (!Review.Revisions.Any()) { return(RedirectToPage("LegacyReview", new { id = id })); } Comments = await _commentsManager.GetReviewCommentsAsync(id); Revision = revisionId != null? Review.Revisions.Single(r => r.RevisionId == revisionId) : Review.Revisions.Last(); PreviousRevisions = Review.Revisions.TakeWhile(r => r != Revision).ToArray(); CodeFile = await _codeFileRepository.GetCodeFileAsync(Revision); var fileDiagnostics = CodeFile.Diagnostics ?? Array.Empty <CodeDiagnostic>(); var fileHtmlLines = CodeFileHtmlRenderer.Normal.Render(CodeFile); if (DiffRevisionId != null) { DiffRevision = PreviousRevisions.Single(r => r.RevisionId == DiffRevisionId); var previousRevisionFile = await _codeFileRepository.GetCodeFileAsync(DiffRevision); var previousHtmlLines = CodeFileHtmlRenderer.ReadOnly.Render(previousRevisionFile); var previousRevisionTextLines = CodeFileRenderer.Instance.Render(previousRevisionFile); var fileTextLines = CodeFileRenderer.Instance.Render(CodeFile); var diffLines = InlineDiff.Compute( previousRevisionTextLines, fileTextLines, previousHtmlLines, fileHtmlLines); Lines = CreateLines(fileDiagnostics, diffLines, Comments); } else { Lines = CreateLines(fileDiagnostics, fileHtmlLines, Comments); } ActiveConversations = ComputeActiveConversations(fileHtmlLines, Comments); TotalActiveConversations = Comments.Threads.Count(t => !t.IsResolved); return(Page()); }