From 3ce7ee184b81b8df47f89c57d0ea2cbd6ca645bb Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 24 Apr 2024 19:57:37 +0200 Subject: -profile.el: require mastodon-http --- lisp/mastodon-profile.el | 1 + 1 file changed, 1 insertion(+) (limited to 'lisp/mastodon-profile.el') diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 7b5a700..2a5e350 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -37,6 +37,7 @@ (require 'cl-lib) (require 'persist) (require 'parse-time) +(require 'mastodon-http) (eval-when-compile (require 'mastodon-tl)) -- cgit v1.2.3 From e6bdc008ed3f66fd5c6903c491e1cf6d4dafd2f3 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Tue, 21 May 2024 12:40:19 +0200 Subject: profiles: support only-media arg --- lisp/mastodon-profile.el | 30 +++++++++++++++++++++--------- lisp/mastodon-tl.el | 2 ++ 2 files changed, 23 insertions(+), 9 deletions(-) (limited to 'lisp/mastodon-profile.el') 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) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index fa0c7bb..6c444d4 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1677,6 +1677,8 @@ call this function after it is set or use something else." 'profile-statuses-no-boosts) ((string-suffix-p "no-replies*" buffer-name) 'profile-statuses-no-replies) + ((string-suffix-p "only-media*" buffer-name) + 'profile-statuses-only-media) ((mastodon-tl--endpoint-str-= "statuses" :suffix) 'profile-statuses) ;; profile followers -- cgit v1.2.3