1
0
Fork 0

- refactored function related to post searching in a thread window.

This commit is contained in:
cage 2024-11-29 10:55:12 +01:00
parent 6cf783bb39
commit 58094bfd59
1 changed files with 18 additions and 23 deletions

View File

@ -1046,37 +1046,32 @@ db:renumber-timeline-message-index."
:previous
(_ "No previous message that contains ~s exists")))
(defmethod search-next-unread ((object thread-window))
(defun search-next-by-status (thread-window searching-function error-message)
(with-accessors ((row-selected-index row-selected-index)
(rows rows)
(timeline-folder timeline-folder)
(timeline-type timeline-type)) object
(a:when-let* ((selected-fields (selected-row-fields object))
(timeline-type timeline-type)) thread-window
(a:when-let* ((selected-fields (selected-row-fields thread-window))
(starting-index (db-utils:db-getf selected-fields :message-index)))
(let ((matching-status (db:search-next-unread-message timeline-type
timeline-folder
starting-index)))
(let ((matching-status (funcall searching-function
timeline-type
timeline-folder
starting-index)))
(if matching-status
(let ((new-message-index (db:row-message-index matching-status)))
(rebuild-lines object new-message-index)
(open-message object))
(ui:info-message (_ "No others unread messages exist")))))))
(rebuild-lines thread-window new-message-index)
(open-message thread-window))
(ui:info-message error-message))))))
(defmethod search-next-unread ((object thread-window))
(search-next-by-status object
#'db:search-next-unread-message
(_ "No others unread message exists")))
(defmethod search-next-undeleted ((object thread-window))
(with-accessors ((row-selected-index row-selected-index)
(rows rows)
(timeline-folder timeline-folder)
(timeline-type timeline-type)) object
(a:when-let* ((selected-fields (selected-row-fields object))
(starting-index (db-utils:db-getf selected-fields :message-index)))
(let ((matching-status (db:search-next-undeleted-message timeline-type
timeline-folder
starting-index)))
(if matching-status
(let ((new-message-index (db:row-message-index matching-status)))
(rebuild-lines object new-message-index)
(open-message object))
(ui:info-message (_ "No others undeleted messages exist")))))))
(search-next-by-status object
#'db:search-next-undeleted-message
(_ "No others message marked for deletion exists")))
(defmethod add-mention ((object thread-window) mention)
(with-accessors ((mentions mentions)) object