From a118ce13de225c2828d09cf1fbbf219a385151ad Mon Sep 17 00:00:00 2001 From: cage Date: Thu, 4 Apr 2024 17:13:48 +0200 Subject: [PATCH] - fixed command: 'thread-go-to-parent-post'. --- src/ui-goodies.lisp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/ui-goodies.lisp b/src/ui-goodies.lisp index 27810f3..8a61586 100644 --- a/src/ui-goodies.lisp +++ b/src/ui-goodies.lisp @@ -3637,12 +3637,20 @@ gemini client certificates!)." :complete-fn #'complete:fediverse-account))) (defun thread-go-to-parent-post () - "Select and move to th parent of the current selected post" - (when-let* ((selected-row (line-oriented-window:selected-row-fields *thread-window*)) - (status-id (actual-author-message-id selected-row)) - (parent-row (db:get-parent-status-row status-id)) - (index (db:row-message-index parent-row)) - (event (make-instance 'thread-goto-message - :payload index))) - (info-message (format nil "~a" index)) + "Select and move to the parent of the current selected post" + (when-let* ((timeline (thread-window:timeline-type *thread-window*)) + (folder (thread-window:timeline-folder *thread-window*)) + (selected-row (line-oriented-window:selected-row-fields *thread-window*)) + (status-id (actual-author-message-id selected-row)) + ;; NB: db:get-parent-status-row does not take into account the folder or timeline... + (generic-parent-row (db:get-parent-status-row status-id)) + (generic-parent-id (db:row-message-status-id generic-parent-row)) + ;; ...so we need to call + ;; db::find-status-id-folder-timeline to get the actual + ;; row for the folder and timeline the user is reading... + (status-parent-row (db::find-status-id-folder-timeline generic-parent-id folder timeline)) + ;; ...and get the correct message index + (index (db:row-message-index status-parent-row)) + (event (make-instance 'thread-goto-message + :payload index))) (push-event event)))