1
0
Fork 0

- [breaking changes] changed table for attachments;

- fixed  bug  that prevented  statuses  missing  attachments when  the
  status was reblogged.
This commit is contained in:
cage 2020-05-30 11:53:17 +02:00
parent fd3f1b617b
commit 32727cf0ae
2 changed files with 51 additions and 46 deletions

View File

@ -237,7 +237,8 @@
+make-close+))) +make-close+)))
(defun make-attachment () (defun make-attachment ()
(query-low-level (strcat (prepare-table +table-attachment+) (query-low-level (strcat (prepare-table +table-attachment+ :autogenerated-id-p nil)
" id TEXT NOT NULL,"
;; one of swconf:*allowed-attachment-type* ;; one of swconf:*allowed-attachment-type*
" type TEXT NOT NULL," " type TEXT NOT NULL,"
" url TEXT NOT NULL," " url TEXT NOT NULL,"
@ -253,8 +254,7 @@
" bitrate TEXT," " bitrate TEXT,"
" description TEXT," " description TEXT,"
" blurhash TEXT," " blurhash TEXT,"
" \"status-id\" TEXT," " \"status-id\" TEXT"
" UNIQUE(id) ON CONFLICT FAIL"
+make-close+))) +make-close+)))
(defun make-conversation () (defun make-conversation ()
@ -431,7 +431,6 @@
(create-table-index +table-status+ '(:folder :timeline :status-id)) (create-table-index +table-status+ '(:folder :timeline :status-id))
(create-table-index +table-account+ '(:id :acct)) (create-table-index +table-account+ '(:id :acct))
(create-table-index +table-followed-user+ '(:user-id)) (create-table-index +table-followed-user+ '(:user-id))
(create-table-index +table-attachment+ '(:id))
(create-table-index +table-subscribed-tag+ '(:id)) (create-table-index +table-subscribed-tag+ '(:id))
(create-table-index +table-ignored-status+ '(:folder :timeline :status-id)) (create-table-index +table-ignored-status+ '(:folder :timeline :status-id))
(create-table-index +table-pagination-status+ '(:folder :timeline :status-id)) (create-table-index +table-pagination-status+ '(:folder :timeline :status-id))
@ -726,7 +725,6 @@ than (swconf:config-purge-history-days-offset) days in the past"
(description tooter:description) (description tooter:description)
(blurhash tooter:blurhash)) object (blurhash tooter:blurhash)) object
(assert status-id) (assert status-id)
(with-no-row-id (+table-attachment+ id)
(let* ((actual-attachment-type (prepare-for-db kind)) (let* ((actual-attachment-type (prepare-for-db kind))
(original-file-metadata (metadata-original metadata)) (original-file-metadata (metadata-original metadata))
(width (prepare-for-db (metadata-width original-file-metadata))) (width (prepare-for-db (metadata-width original-file-metadata)))
@ -762,7 +760,12 @@ than (swconf:config-purge-history-days-offset) days in the past"
bitrate bitrate
description description
blurhash blurhash
status-id)))) status-id)))
(attachment-exists-p (fetch-single (select :*
(from +table-attachment+)
(where (:and (:= :status-id status-id)
(:= :id id)))))))
(when (not attachment-exists-p)
(query insert-query))))) (query insert-query)))))
(defmacro insert-or-update (table keys values) (defmacro insert-or-update (table keys values)

View File

@ -782,12 +782,14 @@ db:renumber-timeline-message-index."
(reblogged-data fields) (reblogged-data fields)
(let ((actual-body (if (string= body reblogged-status-body) (let ((actual-body (if (string= body reblogged-status-body)
body body
(strcat body reblogged-status-body)))) (strcat body reblogged-status-body)))
(actual-attachments (if (string= attachments reblogged-status-attachments)
attachments
(strcat reblogged-status-attachments attachments))))
(setf (message-window:source-text *message-window*) (setf (message-window:source-text *message-window*)
(strcat header (strcat header
actual-body actual-body
reblogged-status-attachments actual-attachments))
attachments))
(db:mark-status-red-p timeline-type timeline-folder status-id) (db:mark-status-red-p timeline-type timeline-folder status-id)
(resync-rows-db object :redraw t) (resync-rows-db object :redraw t)
(program-events:push-event refresh-event) (program-events:push-event refresh-event)