1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2024-12-20 23:34:40 +01:00

- fixed test for deciding if a pair timeline/folder must be renumbered.

This commit is contained in:
cage 2021-03-21 14:36:47 +01:00
parent 6228858e79
commit 11fa85ad79
2 changed files with 23 additions and 13 deletions

View File

@ -1970,12 +1970,15 @@ messages are sorted as below:
(mapcar #'second
(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))
(all-timelines (all-status-timelines)))
(loop for folder in all-folders do
(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
(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))))
(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))
(all-timelines (all-status-timelines)))
(all-timelines (all-status-timelines))
(results ()))
(loop for folder in all-folders do
(loop for timeline in all-timelines do
(let ((marked-to-delete (statuses-marked-to-delete timeline folder)))
(loop for status-to-delete in marked-to-delete do
(add-to-status-ignored (row-message-status-id status-to-delete)
folder
timeline)))))))
(loop for timeline in all-timelines do
(let ((marked-to-delete (statuses-marked-to-delete timeline folder)))
(loop for status-to-delete in marked-to-delete do
(pushnew (cons timeline folder)
results
:test #'equalp)
(add-to-status-ignored (row-message-status-id status-to-delete)
folder
timeline)))))
results))
(defun status-id->username (status-id)
(when-let ((message (fetch-single (make-filtered-message-select nil nil nil nil

View File

@ -473,9 +473,10 @@
(defclass delete-all-status-event (program-event) ())
(defmethod process-event ((object delete-all-status-event))
(db:forget-all-statuses-marked-deleted) ; do not change the order. Forget, then delete.
(db:delete-all-statuses-marked-deleted)
(db:renumber-all-timelines))
;; do not change the order. Forget, then delete.
(let ((timelines/folders-with-forgotten (db:forget-all-statuses-marked-deleted)))
(db:delete-all-statuses-marked-deleted)
(db:renumber-all-timelines timelines/folders-with-forgotten)))
(defclass quit-program-event (program-event) ())