WIP for automatic comments
This commit is contained in:
parent
c09524e1a8
commit
a1533bd452
2 changed files with 42 additions and 6 deletions
|
@ -51,8 +51,20 @@
|
||||||
(str "statuses/" status-id "/context")
|
(str "statuses/" status-id "/context")
|
||||||
#js {}))
|
#js {}))
|
||||||
|
|
||||||
|
(defn get-favorited-by
|
||||||
|
[host-url
|
||||||
|
status-id]
|
||||||
|
(.get (mastodon-client host-url)
|
||||||
|
(str "statuses/" status-id "/favourited_by")
|
||||||
|
#js {}))
|
||||||
|
|
||||||
(defn-spec get-directory any?
|
(defn-spec get-directory any?
|
||||||
[host-url ::host-url]
|
[host-url ::host-url]
|
||||||
(.get (mastodon-client host-url)
|
(.get (mastodon-client host-url)
|
||||||
(str "directory?local=true")
|
(str "directory?local=true")
|
||||||
#js {}))
|
#js {}))
|
||||||
|
|
||||||
|
; TODO:
|
||||||
|
; 1. ID of status with reply: 107655615528722482
|
||||||
|
; 2. Get replies to status
|
||||||
|
; 3. Filter by favorited and or tags
|
|
@ -59,20 +59,44 @@
|
||||||
first)))
|
first)))
|
||||||
out))
|
out))
|
||||||
|
|
||||||
|
(defn favorited-replies? [host-url reply-id account-name]
|
||||||
|
(let [out (chan)]
|
||||||
|
(go (>! out
|
||||||
|
(->>
|
||||||
|
(<p! (api/get-favorited-by host-url reply-id))
|
||||||
|
api/mastojs->edn
|
||||||
|
(filter #(= account-name (:acct %)))
|
||||||
|
(empty?)
|
||||||
|
(not)
|
||||||
|
(infra/debug))))
|
||||||
|
out))
|
||||||
|
|
||||||
(defn init []
|
(defn init []
|
||||||
(go
|
(go
|
||||||
(let [host-url (host-url-from-document)
|
(let [host-url (host-url-from-document)
|
||||||
account-name (account-name-from-document)
|
account-name (account-name-from-document)
|
||||||
account-id (or
|
account-id (or
|
||||||
(account-id-from-document)
|
(account-id-from-document)
|
||||||
(<! (find-account-id host-url account-name)))
|
(<! (find-account-id host-url account-name)))
|
||||||
statuus (->
|
statuus (->
|
||||||
(<p! (api/get-account-statuses host-url account-id))
|
(<p! (api/get-account-statuses host-url account-id))
|
||||||
api/mastojs->edn)
|
api/mastojs->edn)
|
||||||
]
|
test-status (->
|
||||||
(->> statuus
|
(<p! (api/get-replies host-url "107779492679907372"))
|
||||||
(take 4)
|
api/mastojs->edn)
|
||||||
|
filtered (->>
|
||||||
|
(:descendants test-status)
|
||||||
|
(filter #(favorited-replies? host-url (:id %) account-name))
|
||||||
|
(infra/debug))]
|
||||||
|
;(->> statuus
|
||||||
|
; (take 4)
|
||||||
|
; (rb/masto->html)
|
||||||
|
; (render-html)
|
||||||
|
; (render-to-document))
|
||||||
|
(->> filtered
|
||||||
|
(infra/debug)
|
||||||
(rb/masto->html)
|
(rb/masto->html)
|
||||||
(render-html)
|
(render-html)
|
||||||
(render-to-document))
|
(render-to-document)))))
|
||||||
)))
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue