mirror of
https://codeberg.org/cage/tinmop/
synced 2024-12-21 23:43:54 +01:00
- fixed test for deciding if a pair timeline/folder must be renumbered.
This commit is contained in:
parent
6228858e79
commit
11fa85ad79
29
src/db.lisp
29
src/db.lisp
@ -1970,12 +1970,15 @@ messages are sorted as below:
|
|||||||
(mapcar #'second
|
(mapcar #'second
|
||||||
(fetch-all-rows (select (fields (:distinct :timeline)) (from :status)))))
|
(fetch-all-rows (select (fields (:distinct :timeline)) (from :status)))))
|
||||||
|
|
||||||
(defun renumber-all-timelines ()
|
(defun renumber-all-timelines (timelines/folders-with-forgotten)
|
||||||
(let ((all-folders (all-folders))
|
(let ((all-folders (all-folders))
|
||||||
(all-timelines (all-status-timelines)))
|
(all-timelines (all-status-timelines)))
|
||||||
(loop for folder in all-folders do
|
(loop for folder in all-folders do
|
||||||
(loop for timeline in all-timelines
|
(loop for timeline in all-timelines
|
||||||
when (statuses-marked-to-delete timeline folder)
|
when (or (statuses-marked-to-delete timeline folder)
|
||||||
|
(find (cons timeline folder)
|
||||||
|
timelines/folders-with-forgotten
|
||||||
|
:test #'equalp))
|
||||||
do
|
do
|
||||||
(renumber-timeline-message-index timeline folder :account-id nil)))))
|
(renumber-timeline-message-index timeline folder :account-id nil)))))
|
||||||
|
|
||||||
@ -2514,16 +2517,22 @@ status has been downloaded from the net and ignored because belog to an ignored
|
|||||||
(:= :user-id user-id))))
|
(:= :user-id user-id))))
|
||||||
|
|
||||||
(defun forget-all-statuses-marked-deleted ()
|
(defun forget-all-statuses-marked-deleted ()
|
||||||
"Ignore all statuses marked for deletion"
|
"Ignore all statuses marked for deletion. Returns an alist
|
||||||
|
of (timeline, folder) pairs that has statuses marked for deletion."
|
||||||
(let ((all-folders (all-folders))
|
(let ((all-folders (all-folders))
|
||||||
(all-timelines (all-status-timelines)))
|
(all-timelines (all-status-timelines))
|
||||||
|
(results ()))
|
||||||
(loop for folder in all-folders do
|
(loop for folder in all-folders do
|
||||||
(loop for timeline in all-timelines do
|
(loop for timeline in all-timelines do
|
||||||
(let ((marked-to-delete (statuses-marked-to-delete timeline folder)))
|
(let ((marked-to-delete (statuses-marked-to-delete timeline folder)))
|
||||||
(loop for status-to-delete in marked-to-delete do
|
(loop for status-to-delete in marked-to-delete do
|
||||||
(add-to-status-ignored (row-message-status-id status-to-delete)
|
(pushnew (cons timeline folder)
|
||||||
folder
|
results
|
||||||
timeline)))))))
|
:test #'equalp)
|
||||||
|
(add-to-status-ignored (row-message-status-id status-to-delete)
|
||||||
|
folder
|
||||||
|
timeline)))))
|
||||||
|
results))
|
||||||
|
|
||||||
(defun status-id->username (status-id)
|
(defun status-id->username (status-id)
|
||||||
(when-let ((message (fetch-single (make-filtered-message-select nil nil nil nil
|
(when-let ((message (fetch-single (make-filtered-message-select nil nil nil nil
|
||||||
|
@ -473,9 +473,10 @@
|
|||||||
(defclass delete-all-status-event (program-event) ())
|
(defclass delete-all-status-event (program-event) ())
|
||||||
|
|
||||||
(defmethod process-event ((object delete-all-status-event))
|
(defmethod process-event ((object delete-all-status-event))
|
||||||
(db:forget-all-statuses-marked-deleted) ; do not change the order. Forget, then delete.
|
;; do not change the order. Forget, then delete.
|
||||||
(db:delete-all-statuses-marked-deleted)
|
(let ((timelines/folders-with-forgotten (db:forget-all-statuses-marked-deleted)))
|
||||||
(db:renumber-all-timelines))
|
(db:delete-all-statuses-marked-deleted)
|
||||||
|
(db:renumber-all-timelines timelines/folders-with-forgotten)))
|
||||||
|
|
||||||
(defclass quit-program-event (program-event) ())
|
(defclass quit-program-event (program-event) ())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user