From 0b01efc1187ca5d40839c8eed2d9ae7ddef144f7 Mon Sep 17 00:00:00 2001 From: mousebot Date: Tue, 15 Feb 2022 14:03:22 +0100 Subject: make accept/reject foll reqs cmds avail in foll reqs view! --- lisp/mastodon-profile.el | 13 +++++++++++++ lisp/mastodon-tl.el | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 5811a4a..d632e5e 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -57,6 +57,8 @@ (autoload 'mastodon-tl--init "mastodon-tl.el") (autoload 'mastodon-http--patch "mastodon-http") (autoload 'mastodon-http--patch-json "mastodon-http") +(autoload 'mastodon-notifications--follow-request-reject "mastodon-notifications") +(autoload 'mastodon-notifications--follow-request-accept "mastodon-notifications") (defvar mastodon-instance-url) (defvar mastodon-tl--buffer-spec) @@ -72,6 +74,17 @@ map) "Keymap for `mastodon-profile-mode'.") +(defvar mastodon-profile--view-follow-requests-keymap + (let ((map (make-sparse-keymap))) + (define-key map (kbd "r") #'mastodon-notifications--follow-request-reject) + (define-key map (kbd "a") #'mastodon-notifications--follow-request-accept) + ;; (define-key map (kbd "g") 'mastodon-notifications--view-follow-requests + ;; (define-key map (kbd "t") #'mastodon-toot) + (define-key map (kbd "q") #'kill-current-buffer) + (define-key map (kbd "Q") #'kill-buffer-and-window) + map) + "Keymap for viewing follow requests.") + (define-minor-mode mastodon-profile-mode "Toggle mastodon profile minor mode. diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index f3c3527..32bb73e 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1462,7 +1462,8 @@ JSON is the data returned from the server." (mastodon-tl--goto-next-toot) (mastodon-mode) (when (equal endpoint "follow_requests") - (mastodon-profile-mode)) + (mastodon-profile-mode) + (use-local-map mastodon-profile--view-follow-requests-keymap)) (with-current-buffer buffer (setq mastodon-tl--buffer-spec `(buffer-name ,buffer -- cgit v1.2.3 From 907991314d0f4e2b88eeb093a6222468e77c9068 Mon Sep 17 00:00:00 2001 From: mousebot Date: Tue, 15 Feb 2022 15:06:39 +0100 Subject: improve use of goto-next-toot on timeline loading --- lisp/mastodon-tl.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 32bb73e..efccc21 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1459,7 +1459,6 @@ JSON is the data returned from the server." mastodon-tl--timestamp-next-update (time-add (current-time) (seconds-to-time 300))) (funcall update-function json)) - (mastodon-tl--goto-next-toot) (mastodon-mode) (when (equal endpoint "follow_requests") (mastodon-profile-mode) @@ -1477,7 +1476,11 @@ JSON is the data returned from the server." nil ;; don't repeat #'mastodon-tl--update-timestamps-callback (current-buffer) - nil))))) + nil))) + (when (or (equal endpoint "notifications") + (string-prefix-p "timelines" endpoint) + (string-prefix-p "statuses" endpoint)) + (mastodon-tl--goto-next-toot)))) (defun mastodon-tl--init-sync (buffer-name endpoint update-function) "Initialize BUFFER-NAME with timeline targeted by ENDPOINT. @@ -1509,7 +1512,11 @@ Runs synchronously." nil ;; don't repeat #'mastodon-tl--update-timestamps-callback (current-buffer) - nil)))) + nil))) + (when (or (equal endpoint "notifications") + (string-prefix-p "timelines" endpoint) + (string-prefix-p "statuses" endpoint)) + (mastodon-tl--goto-next-toot))) buffer)) (provide 'mastodon-tl) -- cgit v1.2.3