aboutsummaryrefslogtreecommitdiff
path: root/tests/test-pearl-query.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-24 16:58:49 -0500
committerCraig Jennings <c@cjennings.net>2026-05-24 16:58:49 -0500
commit424d7048d5450131283f6bdb99822aa6bccd6b16 (patch)
tree528a95468e5e762a0b4510fa5fc96fef5d0f3c99 /tests/test-pearl-query.el
parentd03d5582197def92ad72e113815a3c4836da1330 (diff)
downloadpearl-424d7048d5450131283f6bdb99822aa6bccd6b16.tar.gz
pearl-424d7048d5450131283f6bdb99822aa6bccd6b16.zip
feat: render recent comments in the bulk issue list
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.
Diffstat (limited to 'tests/test-pearl-query.el')
-rw-r--r--tests/test-pearl-query.el12
1 files changed, 10 insertions, 2 deletions
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