emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/mastodon 089eee6485 15/50: notifs: fix author action bylin


From: ELPA Syncer
Subject: [nongnu] elpa/mastodon 089eee6485 15/50: notifs: fix author action byline, top, for ungrouped. FIX #612
Date: Sat, 2 Nov 2024 13:00:52 -0400 (EDT)

branch: elpa/mastodon
commit 089eee64854ad6d8a880b0949fba7e2c1fb04cc6
Author: marty hiatt <martianhiatus@disroot.org>
Commit: marty hiatt <martianhiatus@disroot.org>

    notifs: fix author action byline, top, for ungrouped. FIX #612
---
 lisp/mastodon-notifications.el | 28 ++++++++++++----------------
 lisp/mastodon-tl.el            | 37 +++++++++++++++++++------------------
 2 files changed, 31 insertions(+), 34 deletions(-)

diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el
index d9f7114a52..862f2a2298 100644
--- a/lisp/mastodon-notifications.el
+++ b/lisp/mastodon-notifications.el
@@ -56,7 +56,6 @@
 (autoload 'mastodon-tl--render-text "mastodon-tl")
 (autoload 'mastodon-notifications-get "mastodon")
 (autoload 'mastodon-tl--byline-uname-+-handle "mastodon-tl")
-(autoload 'mastodon-tl--byline-username "mastodon-tl")
 (autoload 'mastodon-tl--byline-handle "mastodon-tl")
 (autoload 'mastodon-http--get-json "mastodon-http")
 (autoload 'mastodon-media--get-avatar-rendering "mastodon-media")
@@ -243,7 +242,7 @@ JSON is a list of alists."
        ;; body
        (mastodon-notifiations--body-arg
         type filters status profile-note follower-name)
-       ;; action-byline
+       ;; action-byline (top)
        (unless (member type '(follow follow_request mention))
          (downcase
           (mastodon-notifications--byline-concat
@@ -251,10 +250,9 @@ JSON is a list of alists."
        ;; action authors
        (cond ((member type '(follow follow_request mention))
               "") ;; mentions are normal statuses
-             (t (mastodon-tl--byline-username note)))
-       ;; action symbol:
-       (unless (eq type 'mention)
-         (mastodon-tl--symbol type))
+             (t (mastodon-tl--byline-handle note nil
+                                            follower-name
+                                            'mastodon-display-name-face)))
        ;; base toot
        (when (or (eq type 'favourite)
                  (eq type 'boost))
@@ -300,9 +298,6 @@ ACCOUNTS is data of the accounts that have reacted to the 
notification."
                   "") ;; mentions are normal statuses
                  (t (mastodon-notifications--byline-accounts
                      accounts status group)))
-           ;; action symbol:
-           (unless (eq type 'mention)
-             (mastodon-tl--symbol type))
            ;; base toot (no need for update/poll/?)
            (when (member type '(favourite reblog))
              status)
@@ -344,7 +339,7 @@ FILTERS STATUS PROFILE-NOTE FOLLOWER-NAME GROUP."
      (t body))))
 
 (defun mastodon-notifications--insert-note
-    (toot body action-byline action-authors action-symbol
+    (toot body action-byline action-authors
           &optional base-toot unfolded group accounts type)
   "Display the content and byline of timeline element TOOT.
 BODY will form the section of the toot above the byline.
@@ -369,18 +364,19 @@ TYPE is notification type, used for non-group notifs."
   (let* ((type (if type
                    (symbol-name type) ;; non-group
                  (alist-get 'type group)))
+         (action-symbol (unless (eq type 'mention)
+                          (mastodon-tl--symbol (intern type))))
          (toot-foldable
           (and mastodon-tl--fold-toots-at-length
                (length> body mastodon-tl--fold-toots-at-length))))
     (insert
      (propertize ;; top byline, body + byline:
       (concat
-       (propertize ;; top byline
-        (if (equal type "mention")
-            ""
-          (concat action-symbol " " action-authors
-                  action-byline))
-        'byline-top t)
+       (if (equal type "mention")
+           ""
+         (propertize ;; top byline
+          (concat action-symbol " " action-authors action-byline)
+          'byline-top t))
        (propertize body ;; body only
                    'toot-body t) ;; includes newlines etc. for folding
        "\n"
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 3a7988e76b..6f510b30af 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -615,24 +615,25 @@ Do so if type of status at poins is not 
follow_request/follow."
   "Format a byline username from account in TOOT.
 TOOT may be account data, or toot data, in which case acount data
 is extracted from it."
-  (let-alist (or (alist-get 'account toot)
-                 toot) ;; grouped nofifs use account data directly
-    (propertize (if (not (string-empty-p .display_name))
-                    .display_name
-                  .username)
-                'face 'mastodon-display-name-face
-                ;; enable playing of videos when point is on byline:
-                ;; 'attachments (mastodon-tl--get-attachments-for-byline toot)
-                'keymap mastodon-tl--byline-link-keymap
-                ;; echo faves count when point on post author name:
-                ;; which is where --goto-next-toot puts point.
-                'help-echo
-                ;; but don't add it to "following"/"follows" on
-                ;; profile views: we don't have a tl--buffer-spec
-                ;; yet:
-                (unless (or (string-suffix-p "-followers*" (buffer-name))
-                            (string-suffix-p "-following*" (buffer-name)))
-                  (mastodon-tl--format-byline-help-echo toot)))))
+  (let ((data (or (alist-get 'account toot)
+                  toot))) ;; grouped nofifs use account data directly
+    (let-alist data
+      (propertize (if (not (string-empty-p .display_name))
+                      .display_name
+                    .username)
+                  'face 'mastodon-display-name-face
+                  ;; enable playing of videos when point is on byline:
+                  ;; 'attachments (mastodon-tl--get-attachments-for-byline 
toot)
+                  'keymap mastodon-tl--byline-link-keymap
+                  ;; echo faves count when point on post author name:
+                  ;; which is where --goto-next-toot puts point.
+                  'help-echo
+                  ;; but don't add it to "following"/"follows" on
+                  ;; profile views: we don't have a tl--buffer-spec
+                  ;; yet:
+                  (unless (or (string-suffix-p "-followers*" (buffer-name))
+                              (string-suffix-p "-following*" (buffer-name)))
+                    (mastodon-tl--format-byline-help-echo data))))))
 
 (defun mastodon-tl--byline-handle (toot &optional domain string face)
   "Format a byline handle from account in TOOT.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]