diff options
Diffstat (limited to 'lisp/mastodon-notifications.el')
| -rw-r--r-- | lisp/mastodon-notifications.el | 72 | 
1 files changed, 30 insertions, 42 deletions
| diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index 0c56cbb..2091118 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -180,7 +180,7 @@ Can be called in notifications view or in follow-requests view."  (defun mastodon-notifications--reblog (note)    "Format for a `boost' NOTE." -  (mastodon-notifications--format-note note 'boost)) +  (mastodon-notifications--format-note note 'reblog))  (defun mastodon-notifications--status (note)    "Format for a `status' NOTE. @@ -208,6 +208,16 @@ Status notifications are given when                               '(face (font-lock-comment-face shr-text)))))      (buffer-string))) +(defvar mastodon-notifications--action-alist +  '((reblog . "Boosted") +    (favourite . "Favourited") +    (follow-request . "Requested to follow") +    (follow . "Followed") +    (mention . "Mentioned") +    (status . "Posted") +    (poll . "Posted a poll") +    (edit . "Edited"))) +  (defun mastodon-notifications--format-note (note type)    "Format for a NOTE of TYPE."    ;; FIXME: apply/refactor filtering as per/with `mastodon-tl--toot' @@ -230,18 +240,15 @@ Status notifications are given when          nil        (mastodon-tl--insert-status         ;; toot -       (cond ((or (eq type 'follow) -                  (eq type 'follow-request)) +       (cond ((member type '(follow follow-request))                ;; Using reblog with an empty id will mark this as something                ;; non-boostable/non-favable.                (cons '(reblog (id . nil)) note))               ;; reblogs/faves use 'note' to process their own json               ;; not the toot's. this ensures following etc. work on such notifs -             ((or (eq type 'favourite) -                  (eq type 'boost)) +             ((member type '(favourite reblog))                note) -             (t -              status)) +             (t status))         ;; body         (let ((body (if-let ((match (assoc "warn" filters)))                         (mastodon-tl--spoiler toot (cadr match)) @@ -251,54 +258,35 @@ Status notifications are given when                          (if (eq 'follow-request type)                              (mastodon-tl--render-text profile-note)                            (mastodon-tl--content status))))))) -         (cond ((or (eq type 'follow) -                    (eq type 'follow-request)) -                (if (eq type 'follow) -                    (propertize "Congratulations, you have a new follower!" -                                'face 'default) -                  (concat -                   (propertize -                    (format "You have a follow request from... %s" -                            follower) -                    'face 'default) -                   (when mastodon-notifications--profile-note-in-foll-reqs +         (cond ((eq type 'follow) +                (propertize "Congratulations, you have a new follower!" +                            'face 'default)) +               ((eq type 'follow-request) +                (concat +                 (propertize +                  (format "You have a follow request from... %s" +                          follower) +                  'face 'default) +                 (if mastodon-notifications--profile-note-in-foll-reqs                       (concat                        ":\n" -                      (mastodon-notifications--comment-note-text body)))))) -               ((or (eq type 'favourite) -                    (eq type 'boost)) +                      (mastodon-notifications--comment-note-text body)) +                   ""))) +               ((member type '(favourite reblog))                  (mastodon-notifications--comment-note-text body))                 (t body)))         ;; author-byline -       (if (or (eq type 'follow) -               (eq type 'follow-request) -               (eq type 'mention)) +       (if (member type '(follow follow-request mention))             'mastodon-tl--byline-author           (lambda (_status &rest _args) ; unbreak stuff             (mastodon-tl--byline-author note)))         ;; action-byline         (lambda (_status)           (mastodon-notifications--byline-concat -          (cond ((eq type 'boost) -                 "Boosted") -                ((eq type 'favourite) -                 "Favourited") -                ((eq type 'follow-request) -                 "Requested to follow") -                ((eq type 'follow) -                 "Followed") -                ((eq type 'mention) -                 "Mentioned") -                ((eq type 'status) -                 "Posted") -                ((eq type 'poll) -                 "Posted a poll") -                ((eq type 'edit) -                 "Edited")))) +          (alist-get type mastodon-notifications--action-alist)))         id         ;; base toot -       (when (or (eq type 'favourite) -                 (eq type 'boost)) +       (when (member type '(favourite reblog))           status)))))  (defun mastodon-notifications--by-type (note) | 
