diff options
author | marty hiatt <martianhiatus@riseup.net> | 2024-05-27 19:50:16 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus@riseup.net> | 2024-05-27 19:50:16 +0200 |
commit | 2c8318f460b2263054633e3471e9ac3d9f0d4a24 (patch) | |
tree | 8c3d084a10f2dcc533aefe0570b36387058a1280 /lisp | |
parent | 4ebc3624dfc1e8901e26c5aea01061ee9a3dc38a (diff) |
customs for display of profile note in foll req notifs: flag and max length
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mastodon-notifications.el | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index 31c5518..9b40861 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -53,6 +53,25 @@ (autoload 'mastodon-tl--update "mastodon-tl") (autoload 'mastodon-views--view-follow-requests "mastodon-views") +(defgroup mastodon-tl nil + "Nofications in mastodon.el." + :prefix "mastodon-notifications-" + :group 'mastodon) + +(defcustom mastodon-notifications--profile-note-in-foll-reqs t + "When non-nil, show some of a user's profile note in follow +request notifications." + :type '(boolean)) + +(defcustom mastodon-notifications--profile-note-in-foll-reqs-max-length nil + "The maximum character length for display of user profile note in +follow requests. +Profile notes are only displayed if +`mastodon-notifications--profile-note-in-foll-reqs' is non-nil. +If unset, profile notes of any size will be displayed, which may +make them unweildy." + :type '(integer)) + (defvar mastodon-tl--buffer-spec) (defvar mastodon-tl--display-media-p) @@ -187,10 +206,14 @@ Status notifications are given when (defun mastodon-notifications--format-note (note type) "Format for a NOTE of TYPE." (let* ((id (alist-get 'id note)) - (profile-note (when (equal 'follow-request type) - (mastodon-tl--field - 'note - (mastodon-tl--field 'account note)))) + (profile-note + (when (equal 'follow-request type) + (let ((str (mastodon-tl--field + 'note + (mastodon-tl--field 'account note)))) + (if mastodon-notifications--profile-note-in-foll-reqs-max-length + (string-limit str mastodon-notifications--profile-note-in-foll-reqs-max-length) + str)))) (status (mastodon-tl--field 'status note)) (follower (alist-get 'username (alist-get 'account note)))) (mastodon-notifications--insert-status @@ -223,10 +246,13 @@ Status notifications are given when 'face 'default) (concat (propertize - (format "You have a follow request from... %s:\n" + (format "You have a follow request from... %s" follower) 'face 'default) - (mastodon-notifications--comment-note-text body))))) + (when 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 |