mirror of https://codeberg.org/cage/tinmop/
- [breaking changes] changed table for attachments;
- fixed bug that prevented statuses missing attachments when the status was reblogged.
This commit is contained in:
parent
fd3f1b617b
commit
32727cf0ae
85
src/db.lisp
85
src/db.lisp
|
@ -237,7 +237,8 @@
|
|||
+make-close+)))
|
||||
|
||||
(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*
|
||||
" type TEXT NOT NULL,"
|
||||
" url TEXT NOT NULL,"
|
||||
|
@ -253,8 +254,7 @@
|
|||
" bitrate TEXT,"
|
||||
" description TEXT,"
|
||||
" blurhash TEXT,"
|
||||
" \"status-id\" TEXT,"
|
||||
" UNIQUE(id) ON CONFLICT FAIL"
|
||||
" \"status-id\" TEXT"
|
||||
+make-close+)))
|
||||
|
||||
(defun make-conversation ()
|
||||
|
@ -431,7 +431,6 @@
|
|||
(create-table-index +table-status+ '(:folder :timeline :status-id))
|
||||
(create-table-index +table-account+ '(:id :acct))
|
||||
(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-ignored-status+ '(:folder :timeline :status-id))
|
||||
(create-table-index +table-pagination-status+ '(:folder :timeline :status-id))
|
||||
|
@ -726,43 +725,47 @@ than (swconf:config-purge-history-days-offset) days in the past"
|
|||
(description tooter:description)
|
||||
(blurhash tooter:blurhash)) object
|
||||
(assert status-id)
|
||||
(with-no-row-id (+table-attachment+ id)
|
||||
(let* ((actual-attachment-type (prepare-for-db kind))
|
||||
(original-file-metadata (metadata-original metadata))
|
||||
(width (prepare-for-db (metadata-width original-file-metadata)))
|
||||
(height (prepare-for-db (metadata-height original-file-metadata)))
|
||||
(frame-rate (prepare-for-db (metadata-frame-rate original-file-metadata)))
|
||||
(duration (prepare-for-db (metadata-duration original-file-metadata)))
|
||||
(bitrate (prepare-for-db (metadata-bitrate original-file-metadata)))
|
||||
(insert-query (make-insert +table-attachment+
|
||||
(:id
|
||||
:type
|
||||
:url
|
||||
:preview-url
|
||||
:remote-url
|
||||
:text-url
|
||||
:width
|
||||
:height
|
||||
:frame-rate
|
||||
:duration
|
||||
:bitrate
|
||||
:description
|
||||
:blurhash
|
||||
:status-id)
|
||||
(id
|
||||
actual-attachment-type
|
||||
url
|
||||
preview-url
|
||||
remote-url
|
||||
text-url
|
||||
width
|
||||
height
|
||||
frame-rate
|
||||
duration
|
||||
bitrate
|
||||
description
|
||||
blurhash
|
||||
status-id))))
|
||||
(let* ((actual-attachment-type (prepare-for-db kind))
|
||||
(original-file-metadata (metadata-original metadata))
|
||||
(width (prepare-for-db (metadata-width original-file-metadata)))
|
||||
(height (prepare-for-db (metadata-height original-file-metadata)))
|
||||
(frame-rate (prepare-for-db (metadata-frame-rate original-file-metadata)))
|
||||
(duration (prepare-for-db (metadata-duration original-file-metadata)))
|
||||
(bitrate (prepare-for-db (metadata-bitrate original-file-metadata)))
|
||||
(insert-query (make-insert +table-attachment+
|
||||
(:id
|
||||
:type
|
||||
:url
|
||||
:preview-url
|
||||
:remote-url
|
||||
:text-url
|
||||
:width
|
||||
:height
|
||||
:frame-rate
|
||||
:duration
|
||||
:bitrate
|
||||
:description
|
||||
:blurhash
|
||||
:status-id)
|
||||
(id
|
||||
actual-attachment-type
|
||||
url
|
||||
preview-url
|
||||
remote-url
|
||||
text-url
|
||||
width
|
||||
height
|
||||
frame-rate
|
||||
duration
|
||||
bitrate
|
||||
description
|
||||
blurhash
|
||||
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)))))
|
||||
|
||||
(defmacro insert-or-update (table keys values)
|
||||
|
|
|
@ -780,14 +780,16 @@ db:renumber-timeline-message-index."
|
|||
(refresh-event (make-instance 'program-events:refresh-conversations-window-event)))
|
||||
(multiple-value-bind (reblogged-status-body reblogged-status-attachments)
|
||||
(reblogged-data fields)
|
||||
(let ((actual-body (if (string= body reblogged-status-body)
|
||||
body
|
||||
(strcat body reblogged-status-body))))
|
||||
(let ((actual-body (if (string= body reblogged-status-body)
|
||||
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*)
|
||||
(strcat header
|
||||
actual-body
|
||||
reblogged-status-attachments
|
||||
attachments))
|
||||
actual-attachments))
|
||||
(db:mark-status-red-p timeline-type timeline-folder status-id)
|
||||
(resync-rows-db object :redraw t)
|
||||
(program-events:push-event refresh-event)
|
||||
|
|
Loading…
Reference in New Issue