aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/mastodon-notifications.el226
-rw-r--r--lisp/mastodon-tl.el81
-rw-r--r--lisp/mastodon.el29
-rw-r--r--mastodon-index.org96
4 files changed, 251 insertions, 181 deletions
diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el
index f4615fb..23bd1fa 100644
--- a/lisp/mastodon-notifications.el
+++ b/lisp/mastodon-notifications.el
@@ -64,32 +64,17 @@
(autoload 'mastodon-tl--symbol "mastodon-tl")
(autoload 'mastodon-tl--display-or-uname "mastodon-tl")
-(defgroup mastodon-tl nil
- "Nofications in mastodon.el."
- :prefix "mastodon-notifications-"
- :group 'mastodon)
-
-(defcustom mastodon-notifications--profile-note-in-foll-reqs t
- "If non-nil, show a user's profile note in follow request notifications."
- :type '(boolean))
-
-(defcustom mastodon-notifications--profile-note-in-foll-reqs-max-length nil
- "The max character length for 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))
-
-(defcustom mastodon-notifications--images-in-notifs nil
- "Whether to display attached images in notifications."
- :type '(boolean))
+;; notifications defcustoms moved into mastodon.el
+;; as some need to be available without loading this file
(defvar mastodon-tl--buffer-spec)
(defvar mastodon-tl--display-media-p)
(defvar mastodon-mode-map)
(defvar mastodon-tl--fold-toots-at-length)
(defvar mastodon-tl--show-avatars)
+(defvar mastodon-profile-note-in-foll-reqs)
+(defvar mastodon-profile-note-in-foll-reqs-max-length)
+(defvar mastodon-group-notifications)
(defvar mastodon-notifications--types
'("favourite" "reblog" "mention" "poll"
@@ -231,21 +216,66 @@ JSON is a list of alists."
"\nfor account: "
.target_account)))
-(defun mastodon-notifications--format-note (group status accounts)
+(defun mastodon-notifications--format-note (note)
+ "Format for a NOTE, a non-grouped notification."
+ (let* ((type (intern (alist-get 'type note)))
+ (profile-note
+ (when (eq 'follow_request type)
+ (let ((str (mastodon-tl--field
+ 'note
+ (mastodon-tl--field 'account note))))
+ (if mastodon-profile-note-in-foll-reqs-max-length
+ (string-limit str mastodon-profile-note-in-foll-reqs-max-length)
+ str))))
+ (status (mastodon-tl--field 'status note))
+ (follower (alist-get 'account note))
+ (follower-name (alist-get 'username follower))
+ (filtered (mastodon-tl--field 'filtered status))
+ (filters (when filtered
+ (mastodon-tl--current-filters filtered))))
+ (if (and filtered (assoc "hide" filters))
+ nil
+ (mastodon-notifications--insert-note
+ ;; toot
+ (if (member type '(follow follow_request))
+ note ;; full notif, not just follower acct?
+ status)
+ ;; body
+ (mastodon-notifiations--body-arg
+ type filters status profile-note follower-name)
+ ;; action-byline
+ (unless (member type '(follow follow_request mention))
+ (downcase
+ (mastodon-notifications--byline-concat
+ (alist-get type mastodon-notifications--action-alist))))
+ ;; 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))
+ ;; base toot
+ (when (or (eq type 'favourite)
+ (eq type 'boost))
+ status)
+ nil nil nil type))))
+
+(defun mastodon-notifications--format-group-note (group status accounts)
"Format for a GROUP notification.
STATUS is the status's JSON.
ACCOUNTS is data of the accounts that have reacted to the notification."
(let ((folded nil))
;; FIXME: apply/refactor filtering as per/with `mastodon-tl--toot'
(let-alist group
- (let* ((type-sym (intern .type))
+ (let* ((type (intern .type))
(profile-note
- (when (member type-sym '(follow_request))
+ (when (member type '(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)
+ (if mastodon-profile-note-in-foll-reqs-max-length
+ (string-limit str mastodon-profile-note-in-foll-reqs-max-length)
str))))
- (follower (when (member type-sym '(follow follow_request))
+ (follower (when (member type '(follow follow_request))
(car accounts)))
(follower-name (mastodon-tl--field 'username follower))
(filtered (mastodon-tl--field 'filtered status))
@@ -254,62 +284,68 @@ ACCOUNTS is data of the accounts that have reacted to the notification."
(unless (and filtered (assoc "hide" filters))
(mastodon-notifications--insert-note
;; toot
- (if (member type-sym '(follow follow_request))
+ (if (member type '(follow follow_request))
follower
status)
;; body
- (let ((body (if-let ((match (assoc "warn" filters)))
- (mastodon-tl--spoiler status (cadr match))
- (mastodon-tl--clean-tabs-and-nl
- (cond ((mastodon-tl--has-spoiler status)
- (mastodon-tl--spoiler status))
- ((eq type-sym 'follow_request)
- (mastodon-tl--render-text profile-note))
- (t (mastodon-tl--content status)))))))
- (cond
- ((eq type-sym 'follow)
- (propertize "Congratulations, you have a new follower!"
- 'face 'default))
- ((eq type-sym 'follow_request)
- (concat
- (propertize (format "You have a follow request from %s"
- follower-name)
- 'face 'default)
- (when mastodon-notifications--profile-note-in-foll-reqs
- (concat
- ":\n"
- (mastodon-notifications--comment-note-text body)))))
- ((eq type-sym 'severed_relationships)
- (mastodon-notifications--severance-body group))
- ((eq type-sym 'moderation_warning)
- (mastodon-notifications--mod-warning-body group))
- ((member type-sym '(favourite reblog))
- (propertize
- (mastodon-notifications--comment-note-text body)))
- (t body)))
- ;; author-byline
- #'mastodon-tl--byline-author
+ (mastodon-notifiations--body-arg
+ type filters status profile-note follower-name group)
;; action-byline
- (unless (member type-sym '(follow follow_request mention))
+ (unless (member type '(follow follow_request mention))
(downcase
(mastodon-notifications--byline-concat
- (alist-get type-sym mastodon-notifications--action-alist))))
+ (alist-get type mastodon-notifications--action-alist))))
;; action authors
- (cond ((member type-sym '(follow follow_request mention))
+ (cond ((member type '(follow follow_request mention))
"") ;; mentions are normal statuses
(t (mastodon-notifications--byline-accounts
accounts status group)))
;; action symbol:
- (unless (eq type-sym 'mention)
- (mastodon-tl--symbol type-sym))
+ (unless (eq type 'mention)
+ (mastodon-tl--symbol type))
;; base toot (no need for update/poll/?)
- (when (member type-sym '(favourite reblog))
+ (when (member type '(favourite reblog))
status)
folded group accounts))))))
+(defun mastodon-notifiations--body-arg
+ (type &optional filters status profile-note follower-name group)
+ "TYPE is a symbol, a member of `mastodon-notifiations--types'.
+FILTERS STATUS PROFILE-NOTE FOLLOWER-NAME GROUP."
+ (let ((body
+ (if-let ((match (assoc "warn" filters)))
+ (mastodon-tl--spoiler status (cadr match))
+ (mastodon-tl--clean-tabs-and-nl
+ (cond ((mastodon-tl--has-spoiler status)
+ (mastodon-tl--spoiler status))
+ ((eq type 'follow_request)
+ (mastodon-tl--render-text profile-note))
+ (t (mastodon-tl--content status)))))))
+ (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-name)
+ 'face 'default)
+ (when mastodon-profile-note-in-foll-reqs
+ (concat
+ ":\n"
+ (mastodon-notifications--comment-note-text body)))))
+ ((eq type 'severed_relationships)
+ (mastodon-notifications--severance-body group))
+ ((eq type 'moderation_warning)
+ (mastodon-notifications--mod-warning-body group))
+ ((member type '(favourite reblog))
+ (propertize
+ (mastodon-notifications--comment-note-text body)))
+ (t body))))
+
(defun mastodon-notifications--insert-note
- (toot body author-byline action-byline action-authors action-symbol
- &optional base-toot unfolded group accounts)
+ (toot body action-byline action-authors action-symbol
+ &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.
AUTHOR-BYLINE is an optional function for adding the author
@@ -328,8 +364,11 @@ JSON of the toot responded to.
UNFOLDED is a boolean meaning whether to unfold or fold item if
foldable.
GROUP is the notification group data.
-ACCOUNTS is the notification accounts data."
- (let* ((type (alist-get 'type (or group toot)))
+ACCOUNTS is the notification accounts data.
+TYPE is notification type, used for non-group notifs."
+ (let* ((type (if type
+ (symbol-name type) ;; non-group
+ (alist-get 'type group)))
(toot-foldable
(and mastodon-tl--fold-toots-at-length
(length> body mastodon-tl--fold-toots-at-length))))
@@ -342,15 +381,12 @@ ACCOUNTS is the notification accounts data."
(concat action-symbol " " action-authors
action-byline))
'byline-top t)
- (propertize ;; body only
- body
- 'toot-body t) ;; includes newlines etc. for folding
+ (propertize body ;; body only
+ 'toot-body t) ;; includes newlines etc. for folding
"\n"
;; actual byline:
(mastodon-tl--byline
- toot author-byline nil nil base-toot group
- (when (member type '("follow" "follow_request"))
- toot) ;; account data!
+ toot nil nil base-toot group
;; types listed here use base item timestamp, else we use group's
;; latest timestamp:
(when (not (member type '("favourite" "reblog" "edit" "poll")))
@@ -406,7 +442,7 @@ When DOMAIN, force inclusion of user's domain in their handle."
(mastodon-tl--image-trans-check))
(mastodon-media--get-avatar-rendering .avatar))
(let ((uname (mastodon-tl--display-or-uname account)))
- (mastodon-tl--byline-handle toot nil account
+ (mastodon-tl--byline-handle toot nil
uname 'mastodon-display-name-face))
", ")))
nil ", ")
@@ -420,30 +456,34 @@ When DOMAIN, force inclusion of user's domain in their handle."
(cddr accounts) ;; not first two
", ")))))))
-(defun mastodon-notifications--render (json)
- "Display grouped notifications in JSON."
+(defun mastodon-notifications--render (json no-group)
+ "Display grouped notifications in JSON.
+NO-GROUP means don't render grouped notifications."
;; (setq masto-grouped-notifs json)
- (let ((groups (alist-get 'notification_groups json)))
- (cl-loop
- for g in groups
- for start-pos = (point)
- for accounts = (mastodon-notifications--group-accounts
- (alist-get 'sample_account_ids g)
- (alist-get 'accounts json))
- for status = (mastodon-notifications--alist-by-value
- (alist-get 'status_id g) 'id
- (alist-get 'statuses json))
- do (mastodon-notifications--format-note g status accounts)
- (when mastodon-tl--display-media-p
- ;; images-in-notifs custom is handeld in
- ;; `mastodon-tl--media-attachment', not here
- (mastodon-media--inline-images start-pos (point))))))
+ (if no-group
+ (cl-loop for x in json
+ do (mastodon-notifications--format-note x))
+ (let ((groups (alist-get 'notification_groups json)))
+ (cl-loop
+ for g in groups
+ for start-pos = (point)
+ for accounts = (mastodon-notifications--group-accounts
+ (alist-get 'sample_account_ids g)
+ (alist-get 'accounts json))
+ for status = (mastodon-notifications--alist-by-value
+ (alist-get 'status_id g) 'id
+ (alist-get 'statuses json))
+ do (mastodon-notifications--format-group-note g status accounts)
+ (when mastodon-tl--display-media-p
+ ;; images-in-notifs custom is handeld in
+ ;; `mastodon-tl--media-attachment', not here
+ (mastodon-media--inline-images start-pos (point)))))))
(defun mastodon-notifications--timeline (json)
"Format JSON in Emacs buffer."
(if (seq-empty-p json)
(user-error "Looks like you have no (more) notifications for now")
- (mastodon-notifications--render json)
+ (mastodon-notifications--render json (not mastodon-group-notifications))
(goto-char (point-min))))
(defun mastodon-notifications--get-mentions ()
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 5178a25..3a7988e 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -97,7 +97,8 @@
(defvar mastodon-toot--visibility)
(defvar mastodon-toot-mode)
(defvar mastodon-active-user)
-(defvar mastodon-notifications--images-in-notifs)
+(defvar mastodon-images-in-notifs)
+(defvar mastodon-group-notifications)
(when (require 'mpv nil :no-error)
(declare-function mpv-start "mpv"))
@@ -610,14 +611,12 @@ Do so if type of status at poins is not follow_request/follow."
(string= type "follow")) ; no counts for these
(message "%s" echo)))))
-;; FIXME: now that this can also be used for non byline rendering, let's
-;; remove the toot arg, and deal with attachments higher up (on real
-;; author byline only) removing toot arg makes it easier to render notifs
-;; that have no status (foll_reqs)
-(defun mastodon-tl--byline-username (toot &optional account)
+(defun mastodon-tl--byline-username (toot)
"Format a byline username from account in TOOT.
-ACCOUNT is optionally acccount data to use."
- (let-alist (or account (alist-get 'account 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)
@@ -635,7 +634,7 @@ ACCOUNT is optionally acccount data to use."
(string-suffix-p "-following*" (buffer-name)))
(mastodon-tl--format-byline-help-echo toot)))))
-(defun mastodon-tl--byline-handle (toot &optional domain account string face)
+(defun mastodon-tl--byline-handle (toot &optional domain string face)
"Format a byline handle from account in TOOT.
DOMAIN is optionally added to the handle.
ACCOUNT is optionally acccount data to use.
@@ -643,7 +642,8 @@ STRING is optionally the string to propertize.
FACE is optionally the face to use.
The last two args allow for display a username as a clickable
handle."
- (let-alist (or account (alist-get 'account toot))
+ (let-alist (or (alist-get 'account toot)
+ toot) ;; grouped notifs
(propertize (or string
(concat "@" .acct
(when domain
@@ -653,19 +653,18 @@ handle."
'face (or face 'mastodon-handle-face)
'mouse-face 'highlight
'mastodon-tab-stop 'user-handle
- 'account account
'shr-url .url
'keymap mastodon-tl--link-keymap
'mastodon-handle (concat "@" .acct)
'help-echo (concat "Browse user profile of @" .acct))))
-(defun mastodon-tl--byline-uname-+-handle (data &optional domain account)
+(defun mastodon-tl--byline-uname-+-handle (data &optional domain)
"Concatenate a byline username and handle.
DATA is the (toot) data to use.
DOMAIN is optionally a domain for the handle.
ACCOUNT is optionally acccount data to use."
- (concat (mastodon-tl--byline-username data account)
- " (" (mastodon-tl--byline-handle data domain account) ")"))
+ (concat (mastodon-tl--byline-username data)
+ " (" (mastodon-tl--byline-handle data domain) ")"))
(defun mastodon-tl--display-or-uname (account)
"Return display name or username from ACCOUNT data."
@@ -673,7 +672,7 @@ ACCOUNT is optionally acccount data to use."
(alist-get 'display_name account)
(alist-get 'username account)))
-(defun mastodon-tl--byline-author (toot &optional avatar domain base account)
+(defun mastodon-tl--byline-author (toot &optional avatar domain base)
"Propertize author of TOOT.
If TOOT contains a reblog, return author of reblogged item.
With arg AVATAR, include the account's avatar image.
@@ -684,7 +683,7 @@ ACCOUNT is optionally acccount data to use."
(let* ((data (if base
(mastodon-tl--toot-or-base toot)
toot))
- (account (or account (alist-get 'account data)))
+ (account (alist-get 'account data))
(uname (mastodon-tl--display-or-uname account)))
(concat
;; avatar insertion moved up to `mastodon-tl--byline' by default to
@@ -701,11 +700,11 @@ ACCOUNT is optionally acccount data to use."
" "
;; username as button:
(mastodon-tl--byline-handle
- data domain account
+ data domain
;; display uname not handle (for boosts):
uname 'mastodon-display-name-face))
;; normal combo author byline:
- (mastodon-tl--byline-uname-+-handle data domain account)))))
+ (mastodon-tl--byline-uname-+-handle data domain)))))
(defun mastodon-tl--format-byline-help-echo (toot)
"Format a help-echo for byline of TOOT.
@@ -796,8 +795,8 @@ LETTER is a string, F for favourited, B for boosted, or K for bookmarked."
(image-type-available-p 'imagemagick)
(image-transforms-p)))
-(defun mastodon-tl--byline (toot author-byline &optional detailed-p
- domain base-toot group account ts)
+(defun mastodon-tl--byline (toot &optional detailed-p
+ domain base-toot group ts)
"Generate byline for TOOT.
AUTHOR-BYLINE is a function for adding the author portion of
the byline that takes one variable.
@@ -811,7 +810,7 @@ BASE-TOOT is JSON for the base toot, if any.
GROUP is the notification group if any.
ACCOUNT is the notification account if any.
TS is a timestamp from the server, if any."
- (let* ((type (alist-get 'type group))
+ (let* ((type (alist-get 'type (or group toot)))
(created-time
(or ts ;; mentions, statuses, folls/foll-reqs
;; bosts, faves, edits, polls in notifs view use base item
@@ -826,11 +825,9 @@ TS is a timestamp from the server, if any."
(boosted (eq t (mastodon-tl--field 'reblogged toot)))
(bookmarked (eq t (mastodon-tl--field 'bookmarked toot)))
(visibility (mastodon-tl--field 'visibility toot))
- (type (alist-get 'type (or group toot)))
(base-toot-maybe (or base-toot ;; show edits for notifs
(mastodon-tl--toot-or-base toot))) ;; for boosts
- (account (or account
- (alist-get 'account base-toot-maybe)))
+ (account (alist-get 'account base-toot-maybe))
(avatar-url (alist-get 'avatar account))
(edited-time (alist-get 'edited_at base-toot-maybe))
(edited-parsed (when edited-time (date-to-time edited-time))))
@@ -862,7 +859,7 @@ TS is a timestamp from the server, if any."
;; NB: action-byline (boost) is now added in insert-status, so no
;; longer part of the byline.
;; (base) author byline:
- (funcall author-byline toot nil domain :base account)
+ (mastodon-tl--byline-author toot nil domain :base)
;; visibility:
(cond ((string= visibility "direct")
(propertize (concat " " (mastodon-tl--symbol 'direct))
@@ -1327,7 +1324,7 @@ SENSITIVE is a flag from the item's JSON data."
;; if in notifs, also check notifs images custom:
(if (or (mastodon-tl--buffer-type-eq 'notifications)
(mastodon-tl--buffer-type-eq 'mentions))
- mastodon-notifications--images-in-notifs
+ mastodon-images-in-notifs
t))
(mastodon-media--get-media-link-rendering ; placeholder: "[img]"
.preview_url remote-url ; for shr-browse-url
@@ -1655,7 +1652,7 @@ Runs `mastodon-tl--render-text' and fetches poll or media."
(string= reply-to-id prev-id)))
(defun mastodon-tl--insert-status
- (toot body author-byline action-byline &optional id base-toot
+ (toot body action-byline &optional id base-toot
detailed-p thread domain unfolded no-byline)
"Display the content and byline of timeline element TOOT.
BODY will form the section of the toot above the byline.
@@ -1710,8 +1707,7 @@ NO-BYLINE means just insert toot body, used for folding."
"\n"
(if no-byline
""
- (mastodon-tl--byline toot author-byline detailed-p
- domain base-toot)))
+ (mastodon-tl--byline toot detailed-p domain base-toot)))
'item-type 'toot
'item-id (or id ; notification's own id
(alist-get 'id toot)) ; toot id
@@ -1793,16 +1789,16 @@ NO-BYLINE means just insert toot body, used for folding."
(if (and filtered (assoc "hide" filters))
nil ;; no insert
(mastodon-tl--insert-status
- toot
- (mastodon-tl--clean-tabs-and-nl spoiler-or-content)
- #'mastodon-tl--byline-author #'mastodon-tl--byline-boost
- nil nil detailed-p thread domain unfolded no-byline))))
+ toot (mastodon-tl--clean-tabs-and-nl spoiler-or-content)
+ #'mastodon-tl--byline-boost nil nil detailed-p
+ thread domain unfolded no-byline))))
(defun mastodon-tl--timeline (toots &optional thread domain no-byline)
"Display each toot in TOOTS.
This function removes replies if user required.
THREAD means the status will be displayed in a thread view.
-When DOMAIN, force inclusion of user's domain in their handle."
+When DOMAIN, force inclusion of user's domain in their handle.
+NO-BYLINE means just insert toot body, used for folding."
(let ((start-pos (point))
(toots ;; hack to *not* filter replies on profiles:
(if (eq (mastodon-tl--get-buffer-type) 'profile-statuses)
@@ -2245,8 +2241,9 @@ If we are in a notifications view, return `notifications-min-id'."
(save-excursion
(goto-char (point-max))
(mastodon-tl--property
- (if (member (mastodon-tl--get-buffer-type)
- '(mentions notifications))
+ (if (and mastodon-group-notifications
+ (member (mastodon-tl--get-buffer-type)
+ '(mentions notifications)))
'notifications-min-id
'item-id)
nil :backward)))
@@ -2870,7 +2867,8 @@ the current view."
(args (append args params))
(url (mastodon-http--api
endpoint
- (when (or (string= endpoint "notifications")
+ (when (or (and mastodon-group-notifications
+ (string= endpoint "notifications"))
(string-suffix-p "search" endpoint))
"v2"))))
(apply #'mastodon-http--get-json-async url args callback cbargs)))
@@ -3263,7 +3261,8 @@ favourites and bookmarks.
PARAMS is any parameters to send with the request.
HIDE-REPLIES is a flag indicating if replies are hidden in the current buffer.
INSTANCE is a string of another instance domain we are displaying
-a timeline from."
+a timeline from.
+NO-BYLINE means just insert toot body, used for announcements."
(let ((url (if instance
(concat "https://" instance "/api/v1/" endpoint)
(mastodon-http--api endpoint)))
@@ -3283,7 +3282,8 @@ a timeline from."
UPDATE-FUNCTION is used to recieve more toots.
RESPONSE is the data returned from the server by
`mastodon-http--process-json', with arg HEADERS a cons cell of
-JSON and http headers, without it just the JSON."
+JSON and http headers, without it just the JSON.
+NO-BYLINE means just insert toot body, used for announcements."
(let ((json (if headers (car response) response)))
(cond ((not json) ; praying this is right here, else try "\n[]"
;; this means that whatever tl was inited won't load, which is not
@@ -3355,7 +3355,8 @@ ENDPOINT-VERSION is a string, format Vx, e.g. V2."
(defun mastodon-tl--do-init (json update-fun &optional domain no-byline)
"Utility function for `mastodon-tl--init*' and `mastodon-tl--init-sync'.
JSON is the data to call UPDATE-FUN on.
-When DOMAIN, force inclusion of user's domain in their handle."
+When DOMAIN, force inclusion of user's domain in their handle.
+NO-BYLINE means just insert toot body, used for announcements."
(remove-overlays) ; video overlays
(cond (domain ;; maybe our update-fun doesn't always have 3 args...:
(funcall update-fun json nil domain))
diff --git a/lisp/mastodon.el b/lisp/mastodon.el
index 119a045..b544d5b 100644
--- a/lisp/mastodon.el
+++ b/lisp/mastodon.el
@@ -153,6 +153,30 @@ currently, it doesn't seem to have a way to handle custom emoji,
while emojify,el has this feature and mastodon.el implements it."
:type 'boolean)
+;; notifications customizes
+;; moved here because we can load notifs without first loading mastodon.el
+;; or mastodon-notifications.el
+
+(defcustom mastodon-profile-note-in-foll-reqs t
+ "If non-nil, show a user's profile note in follow request notifications."
+ :type '(boolean))
+
+(defcustom mastodon-profile-note-in-foll-reqs-max-length nil
+ "The max character length for user profile note in follow requests.
+Profile notes are only displayed if
+`mastodon-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))
+
+(defcustom mastodon-images-in-notifs nil
+ "Whether to display attached images in notifications."
+ :type '(boolean))
+
+(defcustom mastodon-group-notifications t
+ "Whether to use grouped notifications."
+ :type '(boolean))
+
(defun mastodon-kill-window ()
"Quit window and delete helper."
(interactive)
@@ -372,7 +396,10 @@ MAX-ID is a request parameter for pagination."
type
(when max-id
`(("max_id" . ,(mastodon-tl--buffer-property 'max-id))))
- nil nil nil "v2")
+ nil nil nil
+ (if (not mastodon-group-notifications)
+ "v1"
+ "v2"))
(with-current-buffer (get-buffer-create buffer)
(use-local-map mastodon-notifications--map))))
diff --git a/mastodon-index.org b/mastodon-index.org
index b3d6af7..7e5d2a7 100644
--- a/mastodon-index.org
+++ b/mastodon-index.org
@@ -200,6 +200,7 @@
| a | mastodon-toot--translate-toot-text | Translate text of toot at point. |
| E | mastodon-toot--view-toot-edits | View editing history of the toot at point in a popup buffer. |
| | mastodon-toot-mode | Minor mode for composing toots. |
+| | mastodon-transient--choice-add | Add another poll choice if possible. |
| | mastodon-update-profile-note | Update current user profile note. |
| | mastodon-url-lookup | If a URL resembles a fediverse link, try to load in `mastodon.el'. |
| | mastodon-url-lookup-force | Call `mastodon-url-lookup' without checking if URL is fedi-like. |
@@ -259,50 +260,51 @@
#+end_src
#+RESULTS:
-| Custom variable | Description |
-|--------------------------------------------------------------+-------------------------------------------------------------------------------|
-| mastodon-active-user | Username of the active user. |
-| mastodon-client--token-file | File path where Mastodon access tokens are stored. |
-| mastodon-instance-url | Base URL for the fediverse instance you want to be active. |
-| mastodon-media--avatar-height | Height of the user avatar images (if shown). |
-| mastodon-media--enable-image-caching | Whether images should be cached. |
-| mastodon-media--hide-sensitive-media | Whether media marked as sensitive should be hidden. |
-| mastodon-media--preview-max-height | Max height of any media attachment preview to be shown in timelines. |
-| mastodon-mode-hook | Hook run when entering Mastodon mode. |
-| mastodon-notifications--images-in-notifs | Whether to display attached images in notifications. |
-| mastodon-notifications--profile-note-in-foll-reqs | If non-nil, show a user's profile note in follow request notifications. |
-| mastodon-notifications--profile-note-in-foll-reqs-max-length | The max character length for user profile note in follow requests. |
-| mastodon-profile-mode-hook | Hook run after entering or leaving `mastodon-profile-mode'. |
-| mastodon-profile-update-mode-hook | Hook run after entering or leaving `mastodon-profile-update-mode'. |
-| mastodon-search-mode-hook | Hook run after entering or leaving `mastodon-search-mode'. |
-| mastodon-tl--display-caption-not-url-when-no-media | Display an image's caption rather than URL. |
-| mastodon-tl--display-media-p | A boolean value stating whether to show media in timelines. |
-| mastodon-tl--enable-proportional-fonts | Nonnil to enable using proportional fonts when rendering HTML. |
-| mastodon-tl--enable-relative-timestamps | Whether to show relative (to the current time) timestamps. |
-| mastodon-tl--expand-content-warnings | Whether to expand content warnings by default. |
-| mastodon-tl--fold-toots-at-length | Length, in characters, to fold a toot at. |
-| mastodon-tl--hide-replies | Whether to hide replies from the timelines. |
-| mastodon-tl--highlight-current-toot | Whether to highlight the toot at point. Uses `cursor-face' special property. |
-| mastodon-tl--load-full-sized-images-in-emacs | Whether to load full-sized images inside Emacs. |
-| mastodon-tl--no-fill-on-render | Non-nil to disable filling by shr.el while rendering toot body. |
-| mastodon-tl--remote-local-domains | A list of domains to view the local timelines of. |
-| mastodon-tl--show-avatars | Whether to enable display of user avatars in timelines. |
-| mastodon-tl--show-stats | Whether to show toot stats (faves, boosts, replies counts). |
-| mastodon-tl--symbols | A set of symbols (and fallback strings) to be used in timeline. |
-| mastodon-tl--tag-timeline-tags | A list of up to four tags for use with `mastodon-tl--followed-tags-timeline'. |
-| mastodon-tl--timeline-posts-count | Number of posts to display when loading a timeline. |
-| mastodon-tl-position-after-update | Defines where `point' should be located after a timeline update. |
-| mastodon-toot--attachment-height | Height of the attached images preview in the toot draft buffer. |
-| mastodon-toot--completion-style-for-mentions | The company completion style to use for mentions. |
-| mastodon-toot--default-media-directory | The default directory when prompting for a media file to upload. |
-| mastodon-toot--default-reply-visibility | Default visibility settings when replying. |
-| mastodon-toot--enable-completion | Whether to enable completion of mentions and hashtags. |
-| mastodon-toot--enable-custom-instance-emoji | Whether to enable your instance's custom emoji by default. |
-| mastodon-toot--proportional-fonts-compose | Nonnil to enable using proportional fonts in the compose buffer. |
-| mastodon-toot--use-company-for-completion | Whether to enable company for completion. |
-| mastodon-toot-display-orig-in-reply-buffer | Display a copy of the toot replied to in the compose buffer. |
-| mastodon-toot-mode-hook | Hook run after entering or leaving `mastodon-toot-mode'. |
-| mastodon-toot-orig-in-reply-length | Length to crop toot replied to in the compose buffer to. |
-| mastodon-toot-poll-use-transient | Whether to use the transient menu to create a poll. |
-| mastodon-toot-timestamp-format | Format to use for timestamps. |
-| mastodon-use-emojify | Whether to use emojify.el to display emojis. |
+| Custom variable | Description |
+|----------------------------------------------------+-------------------------------------------------------------------------------|
+| mastodon-active-user | Username of the active user. |
+| mastodon-client--token-file | File path where Mastodon access tokens are stored. |
+| mastodon-group-notifications | Whether to use grouped notifications. |
+| mastodon-images-in-notifs | Whether to display attached images in notifications. |
+| mastodon-instance-url | Base URL for the fediverse instance you want to be active. |
+| mastodon-media--avatar-height | Height of the user avatar images (if shown). |
+| mastodon-media--enable-image-caching | Whether images should be cached. |
+| mastodon-media--hide-sensitive-media | Whether media marked as sensitive should be hidden. |
+| mastodon-media--preview-max-height | Max height of any media attachment preview to be shown in timelines. |
+| mastodon-mode-hook | Hook run when entering Mastodon mode. |
+| mastodon-profile-mode-hook | Hook run after entering or leaving `mastodon-profile-mode'. |
+| mastodon-profile-note-in-foll-reqs | If non-nil, show a user's profile note in follow request notifications. |
+| mastodon-profile-note-in-foll-reqs-max-length | The max character length for user profile note in follow requests. |
+| mastodon-profile-update-mode-hook | Hook run after entering or leaving `mastodon-profile-update-mode'. |
+| mastodon-search-mode-hook | Hook run after entering or leaving `mastodon-search-mode'. |
+| mastodon-tl--display-caption-not-url-when-no-media | Display an image's caption rather than URL. |
+| mastodon-tl--display-media-p | A boolean value stating whether to show media in timelines. |
+| mastodon-tl--enable-proportional-fonts | Nonnil to enable using proportional fonts when rendering HTML. |
+| mastodon-tl--enable-relative-timestamps | Whether to show relative (to the current time) timestamps. |
+| mastodon-tl--expand-content-warnings | Whether to expand content warnings by default. |
+| mastodon-tl--fold-toots-at-length | Length, in characters, to fold a toot at. |
+| mastodon-tl--hide-replies | Whether to hide replies from the timelines. |
+| mastodon-tl--highlight-current-toot | Whether to highlight the toot at point. Uses `cursor-face' special property. |
+| mastodon-tl--load-full-sized-images-in-emacs | Whether to load full-sized images inside Emacs. |
+| mastodon-tl--no-fill-on-render | Non-nil to disable filling by shr.el while rendering toot body. |
+| mastodon-tl--remote-local-domains | A list of domains to view the local timelines of. |
+| mastodon-tl--show-avatars | Whether to enable display of user avatars in timelines. |
+| mastodon-tl--show-stats | Whether to show toot stats (faves, boosts, replies counts). |
+| mastodon-tl--symbols | A set of symbols (and fallback strings) to be used in timeline. |
+| mastodon-tl--tag-timeline-tags | A list of up to four tags for use with `mastodon-tl--followed-tags-timeline'. |
+| mastodon-tl--timeline-posts-count | Number of posts to display when loading a timeline. |
+| mastodon-tl-position-after-update | Defines where `point' should be located after a timeline update. |
+| mastodon-toot--attachment-height | Height of the attached images preview in the toot draft buffer. |
+| mastodon-toot--completion-style-for-mentions | The company completion style to use for mentions. |
+| mastodon-toot--default-media-directory | The default directory when prompting for a media file to upload. |
+| mastodon-toot--default-reply-visibility | Default visibility settings when replying. |
+| mastodon-toot--enable-completion | Whether to enable completion of mentions and hashtags. |
+| mastodon-toot--enable-custom-instance-emoji | Whether to enable your instance's custom emoji by default. |
+| mastodon-toot--proportional-fonts-compose | Nonnil to enable using proportional fonts in the compose buffer. |
+| mastodon-toot--use-company-for-completion | Whether to enable company for completion. |
+| mastodon-toot-display-orig-in-reply-buffer | Display a copy of the toot replied to in the compose buffer. |
+| mastodon-toot-mode-hook | Hook run after entering or leaving `mastodon-toot-mode'. |
+| mastodon-toot-orig-in-reply-length | Length to crop toot replied to in the compose buffer to. |
+| mastodon-toot-poll-use-transient | Whether to use the transient menu to create a poll. |
+| mastodon-toot-timestamp-format | Format to use for timestamps. |
+| mastodon-use-emojify | Whether to use emojify.el to display emojis. |