Split mode functions into raw and rendered

If we want to create different html to the default the raw functions can be used to build html from the reply itself.
This commit is contained in:
bom 2024-11-15 11:02:06 +01:00
parent f0aa2633a7
commit a24ee62d16

View file

@ -61,7 +61,7 @@
first)))
out))
(defn replies-mode [host-url account-name post-id filter-favorited]
(defn replies-mode-raw [host-url account-name post-id filter-favorited]
(go
(let [replies (->
(<p! (api/get-replies host-url post-id))
@ -71,12 +71,16 @@
(->> combined
(filter #(or (not filter-favorited) (:favorited %)))
(reverse)
(map :status)
(th/masto->html "replies-mode")
(render-html)
(b/render-to-document)))))
(map :status)))))
(defn account-mode [host-url account-name]
(defn replies-mode [host-url account-name post-id filter-favorited]
(go
(->> (replies-mode-raw host-url account-name post-id filter-favorited)
(th/masto->html "replies-mode")
(render-html)
(b/render-to-document))))
(defn account-mode-raw [host-url account-name]
(go
(let [account-id (<! (find-account-id host-url account-name))
status (->
@ -85,7 +89,11 @@
(->> status
(filter #(= nil (:reblog %)))
(filter #(= nil (:in_reply_to_account_id %)))
(take 4)
(th/masto->html "account-mode")
(render-html)
(b/render-to-document)))))
(take 4)))))
(defn account-mode [host-url account-name]
(go
(->> (account-mode-raw host-url account-name)
(th/masto->html "account-mode")
(render-html)
(b/render-to-document))))