diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mastodon-notifications.el | 40 | ||||
-rw-r--r-- | lisp/mastodon-tl.el | 4 | ||||
-rw-r--r-- | lisp/mastodon.el | 26 |
3 files changed, 36 insertions, 34 deletions
diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el index fde57f5..f0657fb 100644 --- a/lisp/mastodon-notifications.el +++ b/lisp/mastodon-notifications.el @@ -64,30 +64,8 @@ (autoload 'mastodon-tl--symbol "mastodon-tl") (autoload 'mastodon-tl--display-or-uname "mastodon-tl") -(defgroup mastodon-notifications 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)) - -(defcustom mastodon-notifications--group-notifications t - "Whether to use grouped 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) @@ -244,8 +222,8 @@ JSON is a list of alists." (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) + (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)) @@ -279,7 +257,7 @@ JSON is a list of alists." (propertize (format "You have a follow request from %s" follower-name) 'face 'default) - (when mastodon-notifications--profile-note-in-foll-reqs + (when mastodon-profile-note-in-foll-reqs (concat ":\n" (mastodon-notifications--comment-note-text body))))) @@ -323,8 +301,8 @@ ACCOUNTS is data of the accounts that have reacted to the notification." (profile-note (when (member 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) + (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)) (car accounts))) @@ -356,7 +334,7 @@ ACCOUNTS is data of the accounts that have reacted to the notification." (propertize (format "You have a follow request from %s" follower-name) 'face 'default) - (when mastodon-notifications--profile-note-in-foll-reqs + (when mastodon-profile-note-in-foll-reqs (concat ":\n" (mastodon-notifications--comment-note-text body))))) @@ -530,7 +508,7 @@ When DOMAIN, force inclusion of user's domain in their handle." "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 (not mastodon-notifications--group-notifications)) + (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 ab6951e..4f77f92 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -97,7 +97,7 @@ (defvar mastodon-toot--visibility) (defvar mastodon-toot-mode) (defvar mastodon-active-user) -(defvar mastodon-notifications--images-in-notifs) +(defvar mastodon-images-in-notifs) (when (require 'mpv nil :no-error) (declare-function mpv-start "mpv")) @@ -1326,7 +1326,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 diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 86810b7..211a9bc 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) @@ -373,7 +397,7 @@ MAX-ID is a request parameter for pagination." (when max-id `(("max_id" . ,(mastodon-tl--buffer-property 'max-id)))) nil nil nil - (if (not mastodon-notifications--group-notifications) + (if (not mastodon-group-notifications) "v1" "v2")) (with-current-buffer (get-buffer-create buffer) |