mirror of
https://codeberg.org/cage/tinmop/
synced 2025-02-17 08:10:36 +01:00
- prevented two messages with the same message-index presents in the same folder and timeline.
This commit is contained in:
parent
0d9d83280e
commit
5217636b34
10
src/db.lisp
10
src/db.lisp
@ -1976,12 +1976,22 @@ messages are sorted as below:
|
||||
(loop for folder in all-folders do
|
||||
(loop for timeline in all-timelines
|
||||
when (or (statuses-marked-to-delete timeline folder)
|
||||
(duplicated-message-index-p timeline folder)
|
||||
(find (cons timeline folder)
|
||||
timelines/folders-with-forgotten
|
||||
:test #'equalp))
|
||||
do
|
||||
(renumber-timeline-message-index timeline folder :account-id nil)))))
|
||||
|
||||
(defun duplicated-message-index-p (timeline folder)
|
||||
(let ((all-indices (mapcar #'second
|
||||
(fetch-all-rows (select :message-index
|
||||
(from +table-status+)
|
||||
(where (:and (:= :folder folder)
|
||||
(:= :timeline timeline))))))))
|
||||
(not (length= (remove-duplicates all-indices :test #'=)
|
||||
all-indices))))
|
||||
|
||||
(defun all-attachments-to-status (status-id)
|
||||
(fetch-all-rows (select :*
|
||||
(from +table-attachment+)
|
||||
|
@ -891,6 +891,7 @@
|
||||
:annotated-tree-line->data-plist
|
||||
:renumber-timeline-message-index
|
||||
:renumber-all-timelines
|
||||
:duplicated-message-index-p
|
||||
:all-attachments-to-status
|
||||
:attachment-to-chat-message
|
||||
:all-attachments-urls-to-status
|
||||
|
@ -58,7 +58,9 @@
|
||||
(when (boolean-input-accepted-p maybe-accepted)
|
||||
(let ((delete-event (make-instance 'delete-all-status-event)))
|
||||
(push-event delete-event)))
|
||||
(clean-temporary-files)))
|
||||
(db-utils:with-ready-database (:connect nil)
|
||||
(db:renumber-all-timelines '())
|
||||
(clean-temporary-files))))
|
||||
(let ((delete-count (db:count-status-marked-to-delete))
|
||||
(stop-download-event (make-instance 'gemini-abort-all-downloading-event
|
||||
:priority +maximum-event-priority+)))
|
||||
@ -70,7 +72,9 @@
|
||||
"Delete ~a messages? [y/N] "
|
||||
delete-count)
|
||||
delete-count))
|
||||
(clean-temporary-files)))))
|
||||
(progn
|
||||
(db:renumber-all-timelines '())
|
||||
(clean-temporary-files))))))
|
||||
|
||||
(defun notify (message &key (life nil) (as-error nil) (priority +standard-event-priority+))
|
||||
(let ((event (make-instance 'notify-user-event
|
||||
|
Loading…
x
Reference in New Issue
Block a user