diff options
author | marty hiatt <martianhiatus@riseup.net> | 2024-05-21 12:40:19 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus@riseup.net> | 2024-05-21 12:40:19 +0200 |
commit | e6bdc008ed3f66fd5c6903c491e1cf6d4dafd2f3 (patch) | |
tree | 1c6bf2829dd23cba54f4e2b831b6edfc9d8c78cf /lisp/mastodon-profile.el | |
parent | 9dcffebf366e442d6f69240561a5909e8e8f4da0 (diff) |
profiles: support only-media arg
Diffstat (limited to 'lisp/mastodon-profile.el')
-rw-r--r-- | lisp/mastodon-profile.el | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 2a5e350..fc318e2 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -142,11 +142,12 @@ contains") (mastodon-tl--property 'item-json)) (defun mastodon-profile--make-author-buffer - (account &optional no-reblogs no-replies) + (account &optional no-reblogs no-replies only-media) "Take an ACCOUNT json and insert a user account into a new buffer. NO-REBLOGS means do not display boosts in statuses." (mastodon-profile--make-profile-buffer-for - account "statuses" #'mastodon-tl--timeline no-reblogs nil no-replies)) + account "statuses" #'mastodon-tl--timeline no-reblogs nil + no-replies only-media)) ;; TODO: we shd just load all views' data then switch coz this is slow af: (defun mastodon-profile--account-view-cycle () @@ -157,6 +158,8 @@ NO-REBLOGS means do not display boosts in statuses." ((mastodon-tl--buffer-type-eq 'profile-statuses-no-boosts) (mastodon-profile--open-statuses-no-replies)) ((mastodon-tl--buffer-type-eq 'profile-statuses-no-replies) + (mastodon-profile--open-statuses-only-media)) + ((mastodon-tl--buffer-type-eq 'profile-statuses-only-media) (mastodon-profile--open-followers)) ((mastodon-tl--buffer-type-eq 'profile-followers) (mastodon-profile--open-following)) @@ -179,6 +182,14 @@ NO-REBLOGS means do not display boosts in statuses." mastodon-profile--account :no-reblogs) (user-error "Not in a mastodon profile"))) +(defun mastodon-profile--open-statuses-only-media () + "Open a profile buffer showing only statuses with media." + (interactive) + (if mastodon-profile--account + (mastodon-profile--make-author-buffer + mastodon-profile--account nil nil :only-media) + (user-error "Not in a mastodon profile"))) + (defun mastodon-profile--open-following () "Open a profile buffer showing the accounts that current profile follows." (interactive) @@ -567,7 +578,7 @@ FIELDS means provide a fields vector fetched by other means." (defun mastodon-profile--make-profile-buffer-for (account endpoint-type update-function - &optional no-reblogs headers no-replies) + &optional no-reblogs headers no-replies only-media) "Display profile of ACCOUNT, using ENDPOINT-TYPE and UPDATE-FUNCTION. NO-REBLOGS means do not display boosts in statuses. HEADERS means also fetch link headers for pagination." @@ -577,17 +588,18 @@ HEADERS means also fetch link headers for pagination." (push '("exclude_reblogs" . "t") args)) (no-replies (push '("exclude_replies" . "t") args)) + (only-media + (push '("only_media" . "t") args)) (t args))) (endpoint (format "accounts/%s/%s" .id endpoint-type)) (url (mastodon-http--api endpoint)) (buffer (concat "*mastodon-" .acct "-" - (cond (no-reblogs - (concat endpoint-type "-no-boosts")) - (no-replies - (concat endpoint-type "-no-replies")) - (t - endpoint-type)) + (concat endpoint-type + (cond (no-reblogs "-no-boosts") + (no-replies "-no-replies") + (only-media "-only-media") + (t ""))) "*")) (response (if headers (mastodon-http--get-response url args) |