aboutsummaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-08-30 23:24:45 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2022-08-30 23:24:45 +0200
commite18f266cf6e0032aa33c7b1d229bd09fbb3911b5 (patch)
tree58b530a6b7023412c90fc5ade4aae76a4d7f80da /lisp
parent3c40f6dbb855fb4a3100f1822c4d2a29c29737a2 (diff)
parentefe31d5230a0c310bdc1e2d53ca30c8123aaede2 (diff)
Merge branch 'main' into develop
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mastodon-discover.el2
-rw-r--r--lisp/mastodon-notifications.el28
-rw-r--r--lisp/mastodon-profile.el10
-rw-r--r--lisp/mastodon-tl.el4
-rw-r--r--lisp/mastodon-toot.el1
5 files changed, 42 insertions, 3 deletions
diff --git a/lisp/mastodon-discover.el b/lisp/mastodon-discover.el
index 20ed092..f33b25d 100644
--- a/lisp/mastodon-discover.el
+++ b/lisp/mastodon-discover.el
@@ -90,7 +90,7 @@
("u" "copy URL" 'shr-maybe-probe-and-copy-url))
("Profile view"
("g" "Show following" mastodon-profile--open-following)
- ("s" "Show followers" mastodon-profile--open-followers)
+ ("s" "Show followers" mastodon-profile--open-followers)
("C-c C-c" "Cycle profile views" mastodon-profile-account-view-cycle)
("R" "View follow requests" mastodon-profile--view-follow-requests)
("a" "Accept follow request" mastodon-profile--follow-request-accept)
diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el
index 0d11fb4..9986ede 100644
--- a/lisp/mastodon-notifications.el
+++ b/lisp/mastodon-notifications.el
@@ -268,5 +268,33 @@ of the toot responded to."
"notifications"
'mastodon-notifications--timeline))
+(defun mastodon-notifications-clear ()
+ "Clear all notifications."
+ (interactive)
+ (let ((response
+ (mastodon-http--post (mastodon-http--api "notifications/clear")
+ nil nil)))
+ (mastodon-http--triage
+ response (lambda ()
+ (when mastodon-tl--buffer-spec
+ (mastodon-tl--reload-timeline-or-profile))
+ (message "All notifications cleared!")))))
+
+(defun mastodon-notifications-clear-current-notif ()
+ "Dismiss the notification at point."
+ (interactive)
+ (let* ((id (or (mastodon-tl--property 'toot-id)
+ (mastodon-tl--field 'id
+ (mastodon-tl--property 'toot-json))))
+ (response
+ (mastodon-http--post (mastodon-http--api
+ (format "notifications/%s/dismiss" id))
+ nil nil)))
+ (mastodon-http--triage
+ response (lambda ()
+ (when mastodon-tl--buffer-spec
+ (mastodon-tl--reload-timeline-or-profile))
+ (message "Notification dismissed!")))))
+
(provide 'mastodon-notifications)
;;; mastodon-notifications.el ends here
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el
index 4b541fd..516059e 100644
--- a/lisp/mastodon-profile.el
+++ b/lisp/mastodon-profile.el
@@ -436,6 +436,14 @@ If toot is a boost, opens the profile of the booster."
(message "Loading your profile...")
(mastodon-profile--show-user (mastodon-auth--get-account-name)))
+(defun mastodon-profile--view-author-profile ()
+ "View the profile of author of present toot."
+ (interactive)
+ (let* ((toot-json (mastodon-tl--property 'toot-json))
+ (acct (alist-get 'account toot-json))
+ (handle (alist-get 'acct acct)))
+ (mastodon-profile--show-user handle)))
+
(defun mastodon-profile--account-field (account field)
"Return FIELD from the ACCOUNT.
@@ -494,7 +502,7 @@ These include the author, author of reblogged entries and any user mentioned."
(when status
(let ((this-account
(or (alist-get 'account status) ; status is a toot
- status)) ; status is a user listing
+ status)) ; status is a user listing
(mentions (or (alist-get 'mentions (alist-get 'status status))
(alist-get 'mentions status)))
(reblog (or (alist-get 'reblog (alist-get 'status status))
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 45e7282..079af22 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -65,6 +65,7 @@
(autoload 'mastodon-search--insert-users-propertized "mastodon-search")
(autoload 'mastodon-search--get-user-info "mastodon-search")
(autoload 'mastodon-http--delete "mastodon-http")
+(autoload 'mastodon-profile--view-author-profile "mastodon-profile")
(when (require 'mpv nil :no-error)
(declare-function mpv-start "mpv"))
@@ -196,9 +197,10 @@ types of mastodon links and not just shr.el-generated ones.")
(when (require 'mpv nil :no-error)
(let ((map (make-sparse-keymap)))
(define-key map (kbd "<C-return>") 'mastodon-tl--mpv-play-video-from-byline)
+ (define-key map (kbd "<return>") 'mastodon-profile--view-author-profile)
(keymap-canonicalize map)))
"The keymap to be set for the author byline.
-The idea is that you can play media without navigating to it.")
+It is active where point is placed by `mastodon-tl--goto-next-toot.'")
(defun mastodon-tl--next-tab-item ()
"Move to the next interesting item.
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index be3aaad..23abb84 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -60,6 +60,7 @@
(autoload 'mastodon-http--read-file-as-string "mastodon-http")
(autoload 'mastodon-http--triage "mastodon-http")
(autoload 'mastodon-search--search-accounts-query "mastodon-search")
+(autoload 'mastodon-search--search-tags-query "mastodon-search")
(autoload 'mastodon-tl--as-string "mastodon-tl")
(autoload 'mastodon-tl--clean-tabs-and-nl "mastodon-tl")
(autoload 'mastodon-tl--field "mastodon-tl")