From 424d7048d5450131283f6bdb99822aa6bccd6b16 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 24 May 2026 16:58:49 -0500 Subject: feat: render recent comments in the bulk issue list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A populated list used to look like nothing had comments, because only a single-issue refresh fetched them. The bulk and Custom View queries now pull each issue's most recent comments and render them under the Comments heading, with a marker showing how many are shown against the total: 💬 5/18, or 💬 5/25+ once the count passes the cap. Linear's API has no comment total (no commentCount on Issue, no totalCount on the connection), so I fetch one more than pearl-list-comments-count-cap newest-first: that gives an exact total up to the cap and a "+" beyond it, in a single round trip. pearl-list-comments-shown (default 5) caps how many render. pearl-fetch-comments-in-list (default on) turns the whole thing off to keep the fetch light. The single-issue refresh still shows the full thread, uncapped and unmarked. The marker sits on the Comments heading rather than the issue title, so it stays out of the title-sync hash. I relaxed the append locator to match a marked heading, so adding a comment still finds the existing subtree instead of creating a second one. Verified live: the capped fragment is accepted and the markers render correctly. --- tests/test-pearl-query.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'tests/test-pearl-query.el') diff --git a/tests/test-pearl-query.el b/tests/test-pearl-query.el index b5d2816..697dd9a 100644 --- a/tests/test-pearl-query.el +++ b/tests/test-pearl-query.el @@ -144,8 +144,16 @@ ;;; the bulk query fetches comments so the list can render them (ert-deftest test-pearl-issues-query-requests-comments () - "The bulk issues query selects comments, so a populated list shows them." - (should (string-match-p "comments[[:space:]]*{[[:space:]]*nodes" pearl--issues-query))) + "The bulk issues query selects capped, newest-first comments by default." + (let ((pearl-fetch-comments-in-list t) + (pearl-list-comments-count-cap 25)) + (should (string-match-p "comments(first: 26, orderBy: createdAt)[[:space:]]*{[[:space:]]*nodes" + (pearl--issues-query))))) + +(ert-deftest test-pearl-issues-query-omits-comments-when-disabled () + "With list comments disabled, the bulk query carries no comments selection." + (let ((pearl-fetch-comments-in-list nil)) + (should-not (string-match-p "comments" (pearl--issues-query))))) ;;; malformed remote page shapes -- cgit v1.2.3