public static string CommentsPagePath(string subverse, int submissionID, CommentSortAlgorithm sort, object queryString = null, PathOptions options = null) { //these are all default relative I believe options = options == null ? new PathOptions(false, false) : options; return(BuildUrlPath(null, options, "v", subverse, submissionID.ToString(), sort.ToString().ToLower())); //return $"/v/{subverse}/{submissionID.ToString()}/{sort.ToString().ToLower()}"; }
private async Task <CommentSegment> GetCommentSegment(int submissionID, int?parentID, int startingIndex, CommentSortAlgorithm sort) { var q = new QueryCommentSegment(submissionID, parentID, startingIndex, sort).SetUserContext(User); var results = await q.ExecuteAsync(); return(results); }
private async Task <CommentSegment> GetCommentContext(int submissionID, int commentID, int?contextCount, CommentSortAlgorithm sort) { var q = new QueryCommentContext(submissionID, commentID, contextCount, sort).SetUserContext(User); var results = await q.ExecuteAsync(); return(results); }
//recursive addition of child comments private void AddComments(IEnumerable <usp_CommentTree_Result> queryTree, NestedComment parent, int count, int nestLevel, int currentNestLevel, int collapseThreshold, CommentSortAlgorithm sort, Func <usp_CommentTree_Result, NestedComment> mapToNestedCommentFunc) { if (currentNestLevel < nestLevel) { var children = queryTree.Where(x => x.ParentID == parent.ID && !(x.IsDeleted && x.ChildCount == 0)).ToList(); if (children.Any()) { for (int i = 0; i < count; i++) { if (children.Count > i) { var c = mapToNestedCommentFunc(children[i]); c.IsCollapsed = (c.Sum <= collapseThreshold); var nextNestLevel = currentNestLevel + 1; AddComments(queryTree, c, count, nestLevel, nextNestLevel, collapseThreshold, sort, mapToNestedCommentFunc); parent.AddChildComment(c); parent.Children.TotalCount = children.Count; parent.Children.Sort = sort; } } } else { parent.ChildCount = 0; } } }