From c714d1524d2f369228252d265f0a23fe1c166b14 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Fri, 11 Oct 2024 10:05:28 +0200 Subject: fix foll_reqs, add group/accounts props to notifs --- lisp/mastodon-notifications.el | 15 +++++++-------- lisp/mastodon-tl.el | 10 ++++++---- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index a2c0453..a67ec0f 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -214,14 +214,13 @@ JSON is the full notifications JSON." (let* ((type .type) (type-sym (intern .type)) (profile-note - (when (eq type-sym 'follow-request) - (let ((str (mastodon-tl--field - 'note - (car accounts)))) + (when (eq type-sym 'follow_request) + (let ((str (mastodon-tl--field 'note (car accounts)))) (if mastodon-notifications--profile-note-in-foll-reqs-max-length (string-limit str mastodon-notifications--profile-note-in-foll-reqs-max-length) str)))) (follower (car .sample_account_ids)) + (follower-name (mastodon-tl--field 'username (car accounts))) (filtered (mastodon-tl--field 'filtered status)) ;;toot)) (filters (when filtered (mastodon-tl--current-filters filtered)))) @@ -242,17 +241,17 @@ JSON is the full notifications JSON." (mastodon-tl--clean-tabs-and-nl (if (mastodon-tl--has-spoiler status) (mastodon-tl--spoiler status) - (if (eq type 'follow-request) + (if (eq type-sym 'follow_request) (mastodon-tl--render-text profile-note) (mastodon-tl--content status))))))) (cond ((eq type-sym 'follow) (propertize "Congratulations, you have a new follower!" 'face 'default)) - ((eq type-sym 'follow-request) + ((eq type-sym 'follow_request) (concat (propertize (format "You have a follow request from... %s" - follower) + follower-name) 'face 'default) (when mastodon-notifications--profile-note-in-foll-reqs (concat @@ -273,7 +272,7 @@ JSON is the full notifications JSON." (when (member type-sym '(favourite boost)) status) nil nil nil nil - nil group))))) ;; insert status still needs our group data + nil group accounts))))) ;; insert status still needs our group data ;; FIXME: REFACTOR with -tl--byline: ;; we provide account directly, rather than let-alisting toot diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index f611c89..1b3b9ec 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1522,7 +1522,7 @@ Runs `mastodon-tl--render-text' and fetches poll or media." (defun mastodon-tl--insert-status (toot body author-byline action-byline &optional id base-toot - detailed-p thread domain unfolded no-byline group) + detailed-p thread domain unfolded no-byline group accounts) "Display the content and byline of timeline element TOOT. BODY will form the section of the toot above the byline. AUTHOR-BYLINE is an optional function for adding the author @@ -1549,7 +1549,7 @@ NO-BYLINE means just insert toot body, used for folding." (after-reply-status-p (when (and thread reply-to-id) (mastodon-tl--after-reply-status reply-to-id))) - (type (alist-get 'type toot)) + (type (alist-get 'type (or group toot))) (toot-foldable (and mastodon-tl--fold-toots-at-length (length> body mastodon-tl--fold-toots-at-length)))) @@ -1590,9 +1590,11 @@ NO-BYLINE means just insert toot body, used for folding." 'item-json toot 'base-toot base-toot 'cursor-face 'mastodon-cursor-highlight-face - 'notification-type type 'toot-foldable toot-foldable - 'toot-folded (and toot-foldable (not unfolded))) + 'toot-folded (and toot-foldable (not unfolded)) + 'notification-type type + 'notification-group group + 'notification-accounts accounts) (if no-byline "" "\n")))) (defun mastodon-tl--is-reply (toot) -- cgit v1.2.3