mirror of
https://codeberg.org/cage/tinmop/
synced 2025-02-01 04:26:47 +01:00
- added 'local-user-acct';
- moved 'get-following' from api-pleroma to api-mastodon (this endpoint is not specific to pleroma).
This commit is contained in:
parent
6967793c0a
commit
2c3bac4e54
@ -28,9 +28,10 @@
|
|||||||
(defun main ()
|
(defun main ()
|
||||||
(connect)
|
(connect)
|
||||||
(db-utils:with-ready-database (:connect t)
|
(db-utils:with-ready-database (:connect t)
|
||||||
(let* ((username (db:acct->id (swconf:config-username)))
|
(let* ((username (swconf:config-username))
|
||||||
(local-server-name (swconf:config-server-name))
|
(local-server-name (swconf:config-server-name))
|
||||||
(follows-accounts (api-pleroma:get-following username)))
|
(user-acct (api-client:local-user-acct))
|
||||||
|
(follows-accounts (api-client:get-following user-acct)))
|
||||||
(loop for account in follows-accounts do
|
(loop for account in follows-accounts do
|
||||||
(let ((acct (tooter:account-name account)))
|
(let ((acct (tooter:account-name account)))
|
||||||
(if (scan "@" acct)
|
(if (scan "@" acct)
|
||||||
|
@ -588,6 +588,18 @@ database."
|
|||||||
(when user-id
|
(when user-id
|
||||||
(tooter:reject-request *client* user-id)))
|
(tooter:reject-request *client* user-id)))
|
||||||
|
|
||||||
|
(defun-api-call get-following (user-id &optional (min-id nil) (accum '()))
|
||||||
|
"Get a list of accounts that user is following"
|
||||||
|
(let ((partial (sort-id< (tooter:get-following api-client:*client*
|
||||||
|
user-id
|
||||||
|
:max-id min-id))))
|
||||||
|
(if partial
|
||||||
|
(get-following user-id (tooter:id (first partial)) (append partial accum))
|
||||||
|
accum)))
|
||||||
|
|
||||||
|
(defun local-user-acct ()
|
||||||
|
(tooter:id (tooter:account *client*)))
|
||||||
|
|
||||||
(defclass conversation-tree ()
|
(defclass conversation-tree ()
|
||||||
((id
|
((id
|
||||||
:initform nil
|
:initform nil
|
||||||
|
@ -135,29 +135,5 @@ media `media'. Returns a `chat-message' instance"
|
|||||||
(api-pleroma:post-chat-message api-client:*client* chat-id nil message)
|
(api-pleroma:post-chat-message api-client:*client* chat-id nil message)
|
||||||
(api-pleroma:post-chat-message api-client:*client* chat-id message nil)))
|
(api-pleroma:post-chat-message api-client:*client* chat-id message nil)))
|
||||||
|
|
||||||
(defmethod get-following-accounts ((client tooter:client) (id string)
|
|
||||||
&key
|
|
||||||
(max-id nil)
|
|
||||||
(min-id nil)
|
|
||||||
(since-id nil)
|
|
||||||
(limit 10)
|
|
||||||
(offset 0))
|
|
||||||
(decode-account (tooter:query client
|
|
||||||
(format nil "/api/v1/accounts/~a/following" id)
|
|
||||||
:max-id max-id
|
|
||||||
:min-id min-id
|
|
||||||
:since-id since-id
|
|
||||||
:limit limit
|
|
||||||
:offset offset)))
|
|
||||||
|
|
||||||
(api-client:defun-api-call create-new-chat (user-id)
|
(api-client:defun-api-call create-new-chat (user-id)
|
||||||
(create-chat api-client:*client* user-id))
|
(create-chat api-client:*client* user-id))
|
||||||
|
|
||||||
(api-client:defun-api-call get-following (user-id &optional (min-id nil) (accum '()))
|
|
||||||
"Get a list of accounts that user is following"
|
|
||||||
(let ((partial (api-client:sort-id< (get-following-accounts api-client:*client*
|
|
||||||
user-id
|
|
||||||
:max-id min-id))))
|
|
||||||
(if partial
|
|
||||||
(get-following user-id (tooter:id (first partial)) (append partial accum))
|
|
||||||
accum)))
|
|
||||||
|
@ -1785,7 +1785,6 @@
|
|||||||
:get-chats
|
:get-chats
|
||||||
:post-on-chat
|
:post-on-chat
|
||||||
:create-new-chat
|
:create-new-chat
|
||||||
:get-following
|
|
||||||
:instance-pleroma-p))
|
:instance-pleroma-p))
|
||||||
|
|
||||||
(defpackage :api-client
|
(defpackage :api-client
|
||||||
@ -1829,6 +1828,8 @@
|
|||||||
:follow-requests
|
:follow-requests
|
||||||
:accept-follow-request
|
:accept-follow-request
|
||||||
:reject-follow-request
|
:reject-follow-request
|
||||||
|
:get-following
|
||||||
|
:local-user-acct
|
||||||
:conversation-tree
|
:conversation-tree
|
||||||
:id
|
:id
|
||||||
:last-status
|
:last-status
|
||||||
|
Loading…
x
Reference in New Issue
Block a user