Skip to content

Commit 734715c

Browse files
committed
Report has_more on cursor-opposite side when cursor is set
Paging backward with --before TS proves messages newer than TS exist (TS itself is one of them), so has_more_after must be true. The old logic only derived has_more from peek-ahead detection and missed the cursor signal, leaving users at the end of a --before page with no way to turn around via the footer or JSON cursors. Same symmetry for --after TS implying has_more_before. Applied to both get_messages and get_thread_replies.
1 parent 2e2b0b3 commit 734715c

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/slackcli/client.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,14 @@ def _ts_to_float(value: str) -> float:
272272
elif api_has_more_after_fetch:
273273
has_more_after = True
274274

275+
# Cursor-implied has_more: the caller's own cursor proves there is
276+
# content on the opposite side of the returned slice, even when the
277+
# API's peek-ahead / has_more signal does not reach that far.
278+
if before_ts is not None:
279+
has_more_after = True
280+
if after_ts is not None:
281+
has_more_before = True
282+
275283
return messages, has_more_before, has_more_after
276284

277285
def get_thread_replies(
@@ -385,6 +393,13 @@ def _ts_to_float(value: str) -> float:
385393
filtered = filtered[:count]
386394
has_more_after = True
387395

396+
# Cursor-implied has_more: the caller's own cursor proves there is
397+
# content on the opposite side of the returned slice.
398+
if before_ts is not None:
399+
has_more_after = True
400+
if after_ts is not None:
401+
has_more_before = True
402+
388403
return [parent, *filtered], has_more_before, has_more_after
389404

390405
def fetch_full_thread(

0 commit comments

Comments
 (0)