mirror of
https://codeberg.org/cage/tinmop/
synced 2025-02-23 09:07:37 +01:00
- reindented code.
This commit is contained in:
parent
2c6c22ae9f
commit
d296eb8544
260
src/db.lisp
260
src/db.lisp
@ -641,28 +641,28 @@
|
||||
|
||||
(defun view-search-fediverse-statuses ()
|
||||
(s:select (:status-id
|
||||
:account-id
|
||||
(:as :status.url :url)
|
||||
(:as :status.uri :uri)
|
||||
:content
|
||||
:rendered-text
|
||||
:visibility
|
||||
:sensitive
|
||||
:spoiler-text
|
||||
:reblogs-count
|
||||
:favourites-count
|
||||
:replies-count
|
||||
:language
|
||||
:favourited
|
||||
:reblogged
|
||||
:muted
|
||||
:tags
|
||||
:application
|
||||
:redp
|
||||
:timeline
|
||||
:folder
|
||||
(:as :account.username :username)
|
||||
(:as :account.acct :account))
|
||||
:account-id
|
||||
(:as :status.url :url)
|
||||
(:as :status.uri :uri)
|
||||
:content
|
||||
:rendered-text
|
||||
:visibility
|
||||
:sensitive
|
||||
:spoiler-text
|
||||
:reblogs-count
|
||||
:favourites-count
|
||||
:replies-count
|
||||
:language
|
||||
:favourited
|
||||
:reblogged
|
||||
:muted
|
||||
:tags
|
||||
:application
|
||||
:redp
|
||||
:timeline
|
||||
:folder
|
||||
(:as :account.username :username)
|
||||
(:as :account.acct :account))
|
||||
(s:from :status)
|
||||
(s:inner-join :account :on (:= :account.id :status.account-id))))
|
||||
|
||||
@ -863,7 +863,7 @@ to the corresponding id in table +table-account+"
|
||||
|
||||
(defun last-in-history (prompt)
|
||||
(let* ((query (s:select (:*
|
||||
(:as (s:fields (:max :id)) :max))
|
||||
(:as (s:fields (:max :id)) :max))
|
||||
(s:from :input-history)
|
||||
(s:where (:= :prompt prompt)))))
|
||||
(fetch-single query)))
|
||||
@ -884,12 +884,12 @@ to the corresponding id in table +table-account+"
|
||||
"Return the history entry with prompt `prompt` and id that is greater
|
||||
than `min-id'"
|
||||
(let* ((query (s:select (:id
|
||||
(:as (s:fields (:min :id)) :min)
|
||||
:prompt
|
||||
:input)
|
||||
(:as (s:fields (:min :id)) :min)
|
||||
:prompt
|
||||
:input)
|
||||
(s:from :input-history)
|
||||
(s:where (:and (:> :id min-id)
|
||||
(:= :prompt prompt)))))
|
||||
(:= :prompt prompt)))))
|
||||
(row (fetch-single query)))
|
||||
(and (second row)
|
||||
(values (getf row :min)
|
||||
@ -899,12 +899,12 @@ than `min-id'"
|
||||
"Return the history entry with prompt `prompt` and id that is smaller
|
||||
than `max-id'"
|
||||
(let* ((query (s:select (:id
|
||||
(:as (s:fields (:max :id)) :max)
|
||||
:prompt
|
||||
:input)
|
||||
(:as (s:fields (:max :id)) :max)
|
||||
:prompt
|
||||
:input)
|
||||
(s:from :input-history)
|
||||
(s:where (:and (:< :id max-id)
|
||||
(:= :prompt prompt)))))
|
||||
(:= :prompt prompt)))))
|
||||
(row (fetch-single query)))
|
||||
(and (second row)
|
||||
(values (getf row :max)
|
||||
@ -925,10 +925,10 @@ than `max-id'"
|
||||
(offset :day (- (abs days-in-the-past)))))
|
||||
|
||||
(defun purge-by-date-added (table threshold)
|
||||
"Remove expired entry in history.
|
||||
"Remove expired entry in history.
|
||||
An entry is expired if older than `threshold' days in the past"
|
||||
(query (make-delete table
|
||||
(:< :date-added (prepare-for-db threshold)))))
|
||||
(query (make-delete table
|
||||
(:< :date-added (prepare-for-db threshold)))))
|
||||
|
||||
(defun purge-history ()
|
||||
"Remove expired entry in history.
|
||||
@ -1054,7 +1054,7 @@ than (swconf:config-purge-history-days-offset) days in the past"
|
||||
(fetch-single (s:select :*
|
||||
(s:from +table-poll-option+)
|
||||
(s:where (:and (:= :title title)
|
||||
(:= :poll-id poll-id))))))
|
||||
(:= :poll-id poll-id))))))
|
||||
|
||||
(defun poll-option-exists-p (poll-id title)
|
||||
(find-poll-option poll-id title))
|
||||
@ -1205,9 +1205,9 @@ than (swconf:config-purge-history-days-offset) days in the past"
|
||||
(attachment-exists-p (fetch-single (s:select :*
|
||||
(s:from +table-attachment+)
|
||||
(s:where (:and (:= :attached-to-id
|
||||
attached-to-id)
|
||||
(:= :id
|
||||
id)))))))
|
||||
attached-to-id)
|
||||
(:= :id
|
||||
id)))))))
|
||||
(when (not attachment-exists-p)
|
||||
(query insert-query)))))
|
||||
|
||||
@ -1302,12 +1302,12 @@ than (swconf:config-purge-history-days-offset) days in the past"
|
||||
(entry-exists-p (query (s:select :*
|
||||
(s:from +table-tag-histogram+)
|
||||
(s:where (:and (:= :day actual-day)
|
||||
(:= :tag tag))))))
|
||||
(:= :tag tag))))))
|
||||
(updatable-p (query (s:select :*
|
||||
(s:from +table-tag-histogram+)
|
||||
(s:where (:and (:= :day actual-day)
|
||||
(:= :tag tag)
|
||||
(:< :count use-count)))))))
|
||||
(:= :tag tag)
|
||||
(:< :count use-count)))))))
|
||||
(cond
|
||||
((not entry-exists-p)
|
||||
(query (make-insert +table-tag-histogram+
|
||||
@ -1497,7 +1497,7 @@ than (swconf:config-purge-history-days-offset) days in the past"
|
||||
(query (s:select :*
|
||||
(s:from +table-chat-message+)
|
||||
(s:where (:and (:= :chat-id chat-id)
|
||||
(:= :message-id message-id))))))
|
||||
(:= :message-id message-id))))))
|
||||
|
||||
(defun mark-all-chat-messages-read (chat-id)
|
||||
(query (make-update +table-chat-message+
|
||||
@ -1509,7 +1509,7 @@ than (swconf:config-purge-history-days-offset) days in the past"
|
||||
(second (fetch-single (s:select (s:fields (:count :id))
|
||||
(s:from +table-chat-message+)
|
||||
(s:where (:and (:= :chat-id chat-id)
|
||||
(:= :unreadp +db-true+)))))))
|
||||
(:= :unreadp +db-true+)))))))
|
||||
|
||||
(defmethod update-db ((object api-pleroma:chat-message) &key &allow-other-keys)
|
||||
(with-accessors ((message-id api-pleroma:message-id)
|
||||
@ -1577,8 +1577,8 @@ in ascending order"
|
||||
(let ((all (query (s:select ((:as :attachment.text-url :url))
|
||||
(s:from :attachment)
|
||||
(s:join :chat-message :on (:and (:= :chat-message.attachment-id
|
||||
:attachment.id)
|
||||
(:not-null :chat-message.attachment-id)))
|
||||
:attachment.id)
|
||||
(:not-null :chat-message.attachment-id)))
|
||||
(s:where (:= :chat-message.chat-id chat-id))
|
||||
(s:order-by (:asc :chat-message.id))))))
|
||||
(remove-duplicates (mapcar #'second all) :test #'string=)))
|
||||
@ -1651,13 +1651,13 @@ Update database with the decrypted text in column `rendered-text'"
|
||||
(let* ((query-no-reply (s:select :*
|
||||
(s:from :status)
|
||||
(s:where (:and (:= :timeline timeline-type)
|
||||
(:= :folder folder)
|
||||
(:is-null :in-reply-to-id)))))
|
||||
(:= :folder folder)
|
||||
(:is-null :in-reply-to-id)))))
|
||||
(query-with-reply (s:select :*
|
||||
(s:from :status)
|
||||
(s:where (:and (:= :timeline timeline-type)
|
||||
(:= :folder folder)
|
||||
(:not-null :in-reply-to-id)))))
|
||||
(:= :folder folder)
|
||||
(:not-null :in-reply-to-id)))))
|
||||
(complete-tree (fetch-all-rows query-no-reply))
|
||||
(orphan (remove-if (lambda (row)
|
||||
(let ((id-reply (row-message-reply-to-id row))
|
||||
@ -1756,18 +1756,18 @@ Note that the tuple (`status-id', `folder' and `timeline') is the only key
|
||||
that identify a single message in table :status"
|
||||
(fetch-single (s:select :* (s:from +table-status+)
|
||||
(s:where (:and (:= :status-id status-id)
|
||||
(:= :timeline timeline)
|
||||
(:= :folder folder))))))
|
||||
(:= :timeline timeline)
|
||||
(:= :folder folder))))))
|
||||
|
||||
(defmacro gen-message-select ()
|
||||
"Convenience macro for `make-filtered-message-select'"
|
||||
(let ((select `(s:select (:status.*
|
||||
(:as :account.acct :username)
|
||||
(:as :account.display-name :display-name)
|
||||
(:as :account.locked :locked))
|
||||
(:as :account.acct :username)
|
||||
(:as :account.display-name :display-name)
|
||||
(:as :account.locked :locked))
|
||||
(s:from :status)
|
||||
(s:join :account :on (:= :account.id
|
||||
:status.account-id)))))
|
||||
:status.account-id)))))
|
||||
select))
|
||||
|
||||
(defun make-filtered-message-select (other-columns
|
||||
@ -1929,20 +1929,20 @@ the message identified by the tuple."
|
||||
(msg-utils:add-mention-prefix username))))))
|
||||
|
||||
(defun mentioned-username->acct (username status-id
|
||||
&key
|
||||
(add-mention-prefix t)
|
||||
(ignored-acct-list '()))
|
||||
&key
|
||||
(add-mention-prefix t)
|
||||
(ignored-acct-list '()))
|
||||
"Returns an alist of all known accounts as ('@'local-username . '@'acct)."
|
||||
(let* ((query (if ignored-acct-list
|
||||
(s:select :acct
|
||||
(s:from +table-mention+)
|
||||
(s:where (:and (:= :username username)
|
||||
(:= :status-id status-id)
|
||||
(:not (:in :acct ignored-acct-list)))))
|
||||
(:= :status-id status-id)
|
||||
(:not (:in :acct ignored-acct-list)))))
|
||||
(s:select :acct
|
||||
(s:from +table-mention+)
|
||||
(s:where (:and (:= :username username)
|
||||
(:= :status-id status-id))))))
|
||||
(:= :status-id status-id))))))
|
||||
(acct (second (fetch-single query))))
|
||||
(if add-mention-prefix
|
||||
(msg-utils:add-mention-prefix acct)
|
||||
@ -2171,7 +2171,7 @@ to `timeline', `folder' and `account-id'"
|
||||
(query (s:select :status-id
|
||||
(s:from :status)
|
||||
(s:where (:and (:= :folder folder)
|
||||
(:= :timeline timeline)))
|
||||
(:= :timeline timeline)))
|
||||
(s:order-by (:asc :status-id)))))
|
||||
(when account-id
|
||||
(sc:and-where query `(:= :account-id ,account-id)))
|
||||
@ -2231,8 +2231,8 @@ messages are sorted as below:
|
||||
(query-update (s:update :status
|
||||
(s:set= :message-index new-index)
|
||||
(s:where (:and (:= :status-id status-id)
|
||||
(:= :folder folder)
|
||||
(:= :timeline timeline-type))))))
|
||||
(:= :folder folder)
|
||||
(:= :timeline timeline-type))))))
|
||||
(query query-update)
|
||||
(incf new-index)))))))
|
||||
|
||||
@ -2264,7 +2264,7 @@ messages are sorted as below:
|
||||
(fetch-all-rows (s:select :message-index
|
||||
(s:from +table-status+)
|
||||
(s:where (:and (:= :folder folder)
|
||||
(:= :timeline timeline))))))))
|
||||
(:= :timeline timeline))))))))
|
||||
(not (a:length= (remove-duplicates all-indices :test #'=)
|
||||
all-indices))))
|
||||
|
||||
@ -2323,8 +2323,8 @@ reblogged (if exists)."
|
||||
(let ((query (s:update :status
|
||||
(s:set= column value)
|
||||
(s:where (:and (:= :timeline timeline)
|
||||
(:= :folder folder)
|
||||
(:= :status-id status-id))))))
|
||||
(:= :folder folder)
|
||||
(:= :status-id status-id))))))
|
||||
(query query)))
|
||||
|
||||
(defun mark-status-read (timeline folder status-id)
|
||||
@ -2345,8 +2345,8 @@ reblogged (if exists)."
|
||||
(let ((query (s:select (s:fields (:count :*))
|
||||
(s:from :status)
|
||||
(s:where (:and (:= :folder folder)
|
||||
(:= :timeline timeline)
|
||||
(:= :redp +db-true+))))))
|
||||
(:= :timeline timeline)
|
||||
(:= :redp +db-true+))))))
|
||||
(when account-id
|
||||
(sc:and-where query `(:= :account-id ,account-id)))
|
||||
(second (fetch-single query))))
|
||||
@ -2355,7 +2355,7 @@ reblogged (if exists)."
|
||||
(let ((query (s:select (s:fields (:count :*))
|
||||
(s:from :status)
|
||||
(s:where (:and (:= :folder folder)
|
||||
(:= :timeline timeline))))))
|
||||
(:= :timeline timeline))))))
|
||||
(when account-id
|
||||
(sc:and-where query `(:= :account-id ,account-id)))
|
||||
(second (fetch-single query))))
|
||||
@ -2490,7 +2490,7 @@ Metadata are:
|
||||
to `timeline' , `folder' and possibly `account-id', older than
|
||||
`start-status-message-index'"
|
||||
(let* ((filter-criteria `(:and := ,filter-status-column
|
||||
,filter-status-column-value))
|
||||
,filter-status-column-value))
|
||||
(query (make-filtered-message-select nil
|
||||
timeline
|
||||
folder
|
||||
@ -2544,7 +2544,7 @@ to `timeline' , `folder' and possibly `account-id', older than
|
||||
(query (s:select ((:as (s:fields (:max :message-index)) :max))
|
||||
(s:from :status)
|
||||
(s:where (:and (:= :timeline timeline-type)
|
||||
(:= :folder folder)))))
|
||||
(:= :folder folder)))))
|
||||
account-id
|
||||
(a:when-let ((row (fetch-single query)))
|
||||
(second row))))
|
||||
@ -2553,14 +2553,14 @@ to `timeline' , `folder' and possibly `account-id', older than
|
||||
(let ((query (s:select ((:as (s:fields (:max :status-id)) :max))
|
||||
(s:from table)
|
||||
(s:where (:and (:= :timeline timeline)
|
||||
(:= :folder folder))))))
|
||||
(:= :folder folder))))))
|
||||
(second (fetch-single query))))
|
||||
|
||||
(defun first-status-id-timeline-folder-table (timeline folder table)
|
||||
(let ((query (s:select ((:as (s:fields (:min :status-id)) :min))
|
||||
(s:from table)
|
||||
(s:where (:and (:= :timeline timeline)
|
||||
(:= :folder folder))))))
|
||||
(:= :folder folder))))))
|
||||
(second (fetch-single query))))
|
||||
|
||||
(defun last-status-id-timeline-folder (timeline folder)
|
||||
@ -2585,8 +2585,8 @@ to `timeline' , `folder' and possibly `account-id', older than
|
||||
(fetch-single (s:select :*
|
||||
(s:from +table-pagination-status+)
|
||||
(s:where (:and (:= :status-id status-id)
|
||||
(:= :folder folder)
|
||||
(:= :timeline timeline))))))
|
||||
(:= :folder folder)
|
||||
(:= :timeline timeline))))))
|
||||
|
||||
(defun add-to-pagination-status (status-id folder timeline &key (ensure-no-duplicates nil))
|
||||
(let ((no-duplicate-p (if ensure-no-duplicates
|
||||
@ -2613,8 +2613,8 @@ to `timeline' , `folder' and possibly `account-id', older than
|
||||
(children (message-children timeline-type folder status-id))
|
||||
(query-delete (s:delete-from :status
|
||||
(s:where (:and (:= :timeline timeline-type)
|
||||
(:= :folder folder)
|
||||
(:= :status-id status-id))))))
|
||||
(:= :folder folder)
|
||||
(:= :status-id status-id))))))
|
||||
(with-db-transaction
|
||||
(query query-delete)
|
||||
(loop for child in children do
|
||||
@ -2629,8 +2629,8 @@ to `timeline' , `folder' and possibly `account-id', older than
|
||||
"delete status row"
|
||||
(let ((query-delete (s:delete-from :status
|
||||
(s:where (:and (:= :timeline timeline-type)
|
||||
(:= :folder folder)
|
||||
(:= :status-id status-id))))))
|
||||
(:= :folder folder)
|
||||
(:= :status-id status-id))))))
|
||||
(query query-delete)))
|
||||
|
||||
(defun count-status-marked-to-delete ()
|
||||
@ -2642,8 +2642,8 @@ to `timeline' , `folder' and possibly `account-id', older than
|
||||
(query (s:select :*
|
||||
(s:from :status)
|
||||
(s:where (:and (:= :deletedp +db-true+)
|
||||
(:= :timeline timeline)
|
||||
(:= :folder folder))))))
|
||||
(:= :timeline timeline)
|
||||
(:= :folder folder))))))
|
||||
|
||||
(defun delete-all-statuses-marked-deleted ()
|
||||
"Delete all messages marked for deletion and parent message (AKA
|
||||
@ -2676,9 +2676,9 @@ where all parent messages are saved."
|
||||
(let ((query (s:select (s:fields (:max (:length :account.acct)))
|
||||
(s:from :status)
|
||||
(s:join :account :on (:= :account.id
|
||||
:status.account-id))
|
||||
:status.account-id))
|
||||
(s:where (:and (:= :timeline timeline-type)
|
||||
(:= :folder folder))))))
|
||||
(:= :folder folder))))))
|
||||
(second (fetch-single query))))
|
||||
|
||||
(defgeneric keyword->dbcolumn (object))
|
||||
@ -2698,7 +2698,7 @@ where all parent messages are saved."
|
||||
(fetch-all-rows (s:select :*
|
||||
(s:from :status)
|
||||
(s:where (:and (:= :folder folder)
|
||||
(:= :timeline timeline))))))
|
||||
(:= :timeline timeline))))))
|
||||
|
||||
(defun move-message-to-folder (timeline folder status-id destination-folder)
|
||||
(let ((message-exists-p (message-from-timeline-folder-id timeline folder status-id)))
|
||||
@ -2786,7 +2786,7 @@ account that wrote the status identified by `status-id'"
|
||||
(fetch-all-rows (s:select :account.acct
|
||||
(s:from :account)
|
||||
(s:join :followed-user :on (:= :account.id
|
||||
:followed-user.user-id))))))
|
||||
:followed-user.user-id))))))
|
||||
|
||||
(defun all-unfollowed-usernames (&key (remove-ignored nil))
|
||||
(let ((all (all-usernames))
|
||||
@ -2802,8 +2802,8 @@ account that wrote the status identified by `status-id'"
|
||||
(query (s:select :*
|
||||
(s:from :ignored-status)
|
||||
(s:where (:and (:= :status-id status-id)
|
||||
(:= :folder folder)
|
||||
(:= :timeline timeline))))))
|
||||
(:= :folder folder)
|
||||
(:= :timeline timeline))))))
|
||||
|
||||
(defun status-skipped-p (status-id folder timeline)
|
||||
"Return non nil if this status should be skipped because belong to an ignored account
|
||||
@ -2812,8 +2812,8 @@ account that wrote the status identified by `status-id'"
|
||||
(query (s:select :*
|
||||
(s:from +table-skipped-status+)
|
||||
(s:where (:and (:= :status-id status-id)
|
||||
(:= :folder folder)
|
||||
(:= :timeline timeline))))))
|
||||
(:= :folder folder)
|
||||
(:= :timeline timeline))))))
|
||||
|
||||
(defmacro with-db-current-timestamp ((timestamp) &body body)
|
||||
`(let ((,timestamp (prepare-for-db (misc:local-time-obj-now))))
|
||||
@ -2904,7 +2904,7 @@ of (timeline, folder) pairs that has statuses marked for deletion."
|
||||
(s:from +table-subscribed-tag+))))
|
||||
(when sort-data
|
||||
(sc:order-by= query
|
||||
'(:asc :id)))
|
||||
'(:asc :id)))
|
||||
(fetch-all-rows query)))
|
||||
|
||||
(defun all-subscribed-tags-name (&key (sort-data nil) (as-folder-name t))
|
||||
@ -2943,14 +2943,14 @@ name"
|
||||
(let* ((max-status-id-row (fetch-single (s:select (s:fields (:max :status-id))
|
||||
(s:from +table-status+)
|
||||
(s:where (:= :folder
|
||||
(tag->folder-name tag))))))
|
||||
(tag->folder-name tag))))))
|
||||
(max-status-id (second max-status-id-row)))
|
||||
(if (not include-ignored)
|
||||
max-status-id
|
||||
(let* ((max-ignored-status-id-row (fetch-single (s:select (s:fields (:max :status-id))
|
||||
(s:from +table-ignored-status+)
|
||||
(s:where (:= :folder
|
||||
(tag->folder-name tag))))))
|
||||
(tag->folder-name tag))))))
|
||||
(max-ignored-status-id (second max-ignored-status-id-row)))
|
||||
(or max-status-id
|
||||
max-ignored-status-id)))))
|
||||
@ -3097,14 +3097,14 @@ conversation"
|
||||
(defun conversation-messages (name)
|
||||
"returns all the message in a conversation in folder `name'"
|
||||
(let ((statuses (query (s:select ((:as :conversation.id :conversation-id)
|
||||
(:as :account.acct :username)
|
||||
(:as :account.locked :locked)
|
||||
:status.*)
|
||||
(:as :account.acct :username)
|
||||
(:as :account.locked :locked)
|
||||
:status.*)
|
||||
(s:from :status)
|
||||
(s:join :account :on (:= :account.id
|
||||
:status.account-id))
|
||||
:status.account-id))
|
||||
(s:join :conversation :on (:= :conversation.folder
|
||||
:status.folder))
|
||||
:status.folder))
|
||||
(s:where (:= :conversation.folder name))))))
|
||||
statuses))
|
||||
|
||||
@ -3216,7 +3216,7 @@ conversation removed (default: remove)"
|
||||
(fetch-single (s:select :*
|
||||
(s:from :cache)
|
||||
(s:where (:and (:= :key key)
|
||||
(:= :type type))))))
|
||||
(:= :type type))))))
|
||||
|
||||
(defun cache-get-value (key)
|
||||
"Get cache value identified by `key'"
|
||||
@ -3275,7 +3275,7 @@ than `days-in-the-past' days (default: `(swconf:config-purge-cache-days-offset)'
|
||||
(query (s:select :*
|
||||
(s:from +table-cache+)
|
||||
(s:where (:and (:like :key text-looking-for)
|
||||
(:= :type +cache-tls-certificate-type+)))
|
||||
(:= :type +cache-tls-certificate-type+)))
|
||||
(s:order-by (:desc :updated-at)))))
|
||||
(fetch-all-rows query)))
|
||||
|
||||
@ -3301,24 +3301,24 @@ than `days-in-the-past' days (default: `(swconf:config-purge-cache-days-offset)'
|
||||
|
||||
(defun gemini-all-subscriptions ()
|
||||
(a:when-let* ((query (s:select (:gemini-subscription.*
|
||||
(:as (s:select (s:fields (:count :url))
|
||||
(s:from :gemlog-entries)
|
||||
(s:where (:and (:= :gemlog-entries.seenp
|
||||
(prepare-for-db nil :to-integer t))
|
||||
(:= :gemlog-entries.deletedp
|
||||
(prepare-for-db nil :to-integer t))
|
||||
(:= :gemlog-entries.gemlog-id
|
||||
:gemini-subscription.url))))
|
||||
:unseen-count)
|
||||
(:as (s:select (s:fields (:count :url))
|
||||
(s:from :gemlog-entries)
|
||||
(s:where (:and (:= :gemlog-entries.seenp
|
||||
(prepare-for-db t :to-integer t))
|
||||
(:= :gemlog-entries.deletedp
|
||||
(prepare-for-db nil :to-integer t))
|
||||
(:= :gemlog-entries.gemlog-id
|
||||
:gemini-subscription.url))))
|
||||
:seen-count))
|
||||
(:as (s:select (s:fields (:count :url))
|
||||
(s:from :gemlog-entries)
|
||||
(s:where (:and (:= :gemlog-entries.seenp
|
||||
(prepare-for-db nil :to-integer t))
|
||||
(:= :gemlog-entries.deletedp
|
||||
(prepare-for-db nil :to-integer t))
|
||||
(:= :gemlog-entries.gemlog-id
|
||||
:gemini-subscription.url))))
|
||||
:unseen-count)
|
||||
(:as (s:select (s:fields (:count :url))
|
||||
(s:from :gemlog-entries)
|
||||
(s:where (:and (:= :gemlog-entries.seenp
|
||||
(prepare-for-db t :to-integer t))
|
||||
(:= :gemlog-entries.deletedp
|
||||
(prepare-for-db nil :to-integer t))
|
||||
(:= :gemlog-entries.gemlog-id
|
||||
:gemini-subscription.url))))
|
||||
:seen-count))
|
||||
(s:from +table-gemini-subscription+)
|
||||
(s:order-by (:desc :unseen-count) :title :subtitle :url)))
|
||||
(rows (fetch-all-rows query)))
|
||||
@ -3382,19 +3382,19 @@ than `days-in-the-past' days (default: `(swconf:config-purge-cache-days-offset)'
|
||||
(assert (not (and unseen-only
|
||||
seen-only)))
|
||||
(a:when-let* ((query (s:select ((:as :gemini-subscription.url :gemlog-url)
|
||||
(:as :gemini-subscription.title :gemlog-title)
|
||||
(:as :gemini-subscription.subtitle :gemlog-subtitle)
|
||||
(:as :gemlog-entries.date :post-date)
|
||||
(:as :gemlog-entries.title :post-title)
|
||||
(:as :gemlog-entries.url :post-link)
|
||||
(:as :gemlog-entries.seenp :seenp))
|
||||
(:as :gemini-subscription.title :gemlog-title)
|
||||
(:as :gemini-subscription.subtitle :gemlog-subtitle)
|
||||
(:as :gemlog-entries.date :post-date)
|
||||
(:as :gemlog-entries.title :post-title)
|
||||
(:as :gemlog-entries.url :post-link)
|
||||
(:as :gemlog-entries.seenp :seenp))
|
||||
(s:from :gemlog-entries)
|
||||
(s:join :gemini-subscription
|
||||
:on (:= :gemlog-entries.gemlog-id
|
||||
:gemini-subscription.url))
|
||||
:on (:= :gemlog-entries.gemlog-id
|
||||
:gemini-subscription.url))
|
||||
(s:where (:and (:= :gemini-subscription.url gemlog-url)
|
||||
(:= :gemlog-entries.deletedp
|
||||
(prepare-for-db nil :to-integer t))))))
|
||||
(:= :gemlog-entries.deletedp
|
||||
(prepare-for-db nil :to-integer t))))))
|
||||
(unordered-rows (fetch-all-rows query))
|
||||
(actual-rows (cond
|
||||
(unseen-only
|
||||
@ -3606,7 +3606,7 @@ Rows are ordered from the most recent to the oldest."
|
||||
(query (s:select :*
|
||||
(s:from :input-history)
|
||||
(s:where (:and (:<= :date-added to)
|
||||
(:> :date-added from)
|
||||
(:= :prompt prompt)))
|
||||
(:> :date-added from)
|
||||
(:= :prompt prompt)))
|
||||
(s:order-by (:desc :date-added)))))
|
||||
(fetch-all (query query)))))
|
||||
|
Loading…
x
Reference in New Issue
Block a user