[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/mastodon 89f93a1316 08/50: remove ACCOUNT and TYPE from ou
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/mastodon 89f93a1316 08/50: remove ACCOUNT and TYPE from our byline functions. |
Date: |
Sat, 2 Nov 2024 13:00:51 -0400 (EDT) |
branch: elpa/mastodon
commit 89f93a1316b229313dac36125a6ad439ed1e1ae1
Author: marty hiatt <martianhiatus@disroot.org>
Commit: marty hiatt <martianhiatus@disroot.org>
remove ACCOUNT and TYPE from our byline functions.
to avoid them, for foll/reqs we send the full notif as TOOT arg, and fetch
type/account from it as needed. muuuuuuuuch simpler, fingers crossed.
fix grouped notifs new non-account arg byline code
fix handle byline for grouped notifs
---
lisp/mastodon-notifications.el | 18 ++++++------------
lisp/mastodon-tl.el | 41 +++++++++++++++++++----------------------
2 files changed, 25 insertions(+), 34 deletions(-)
diff --git a/lisp/mastodon-notifications.el b/lisp/mastodon-notifications.el
index 6d6b339df6..1b04699a29 100644
--- a/lisp/mastodon-notifications.el
+++ b/lisp/mastodon-notifications.el
@@ -238,7 +238,7 @@ JSON is a list of alists."
(mastodon-notifications--insert-note
;; toot
(if (member type '(follow follow_request))
- follower
+ note ;; full notif, not just follower acct?
status)
;; body
(mastodon-notifiations--body-arg
@@ -281,8 +281,7 @@ 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 (alist-get 'account note))))
+ (t (mastodon-tl--byline-username note)))
;; action symbol:
(unless (eq type 'mention)
(mastodon-tl--symbol type))
@@ -395,7 +394,8 @@ 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."
+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)))
@@ -417,16 +417,10 @@ ACCOUNTS is the notification accounts data."
;; actual byline:
(mastodon-tl--byline
toot nil nil base-toot group
- ;; FIXME: remove account arg (esp. if we have type). maybe we need
- ;; type arg when we step from notifs (here); to tl--byline land
- ;; (there):
- (when (member type '("follow" "follow_request"))
- toot) ;; account data!
;; types listed here use base item timestamp, else we use group's
;; latest timestamp:
(when (not (member type '("favourite" "reblog" "edit" "poll")))
- (mastodon-tl--field 'latest_page_notification_at group))
- type))
+ (mastodon-tl--field 'latest_page_notification_at group))))
'item-type 'toot ;; for nav, actions, etc.
'item-id (or (alist-get 'page_max_id group) ;; newest notif
(alist-get 'id toot)) ; toot id
@@ -478,7 +472,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 ", ")
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 61014ffe67..4846164346 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -610,14 +610,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 +633,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 +641,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 +652,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 +671,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 +682,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 +699,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.
@@ -797,7 +795,7 @@ LETTER is a string, F for favourited, B for boosted, or K
for bookmarked."
(image-transforms-p)))
(defun mastodon-tl--byline (toot &optional detailed-p
- domain base-toot group account ts type)
+ 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 +809,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 (or type (alist-get 'type (or group toot))))
+ (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
@@ -828,8 +826,7 @@ TS is a timestamp from the server, if any."
(visibility (mastodon-tl--field 'visibility 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))))
@@ -861,7 +858,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:
- (mastodon-tl--byline-author toot nil domain :base account)
+ (mastodon-tl--byline-author toot nil domain :base)
;; visibility:
(cond ((string= visibility "direct")
(propertize (concat " " (mastodon-tl--symbol 'direct))
- [nongnu] elpa/mastodon updated (c241b0ba9d -> 31557be472), ELPA Syncer, 2024/11/02
- [nongnu] elpa/mastodon 7d61f38a6b 07/50: FIX #609. insert-status remove author-byline arg, its always the same function, ELPA Syncer, 2024/11/02
- [nongnu] elpa/mastodon 198c7ae8c7 24/50: bump tp version, bump version, ELPA Syncer, 2024/11/02
- [nongnu] elpa/mastodon 16779f5820 39/50: readme for some of the new stuff, ELPA Syncer, 2024/11/02
- [nongnu] elpa/mastodon 6f9cb5c18f 36/50: add mention symbol, ELPA Syncer, 2024/11/02
- [nongnu] elpa/mastodon 464d2e4634 20/50: notifs: factor an action-byline fun (maybe move into insert-note), ELPA Syncer, 2024/11/02
- [nongnu] elpa/mastodon 89f93a1316 08/50: remove ACCOUNT and TYPE from our byline functions.,
ELPA Syncer <=
- [nongnu] elpa/mastodon db0e6bdf54 12/50: Merge branch 'develop' into non-group-notifs, ELPA Syncer, 2024/11/02
- [nongnu] elpa/mastodon 2b281fcc49 13/50: byte-compile, ELPA Syncer, 2024/11/02
- [nongnu] elpa/mastodon 411e9f22e0 14/50: grouped notifs: top byline create with account data, not toot. #612 half fixed., ELPA Syncer, 2024/11/02
- [nongnu] elpa/mastodon 380c6be86f 22/50: keep cleaning up notifs insert note, ELPA Syncer, 2024/11/02
- [nongnu] elpa/mastodon c7a3ed75ab 26/50: fold-toot - respect CW state, ELPA Syncer, 2024/11/02
- [nongnu] elpa/mastodon 8a8b13dc0a 21/50: --byline: pull fave/boost/edit/visibility from base toot if present, ELPA Syncer, 2024/11/02
- [nongnu] elpa/mastodon 1bf73f2528 33/50: remove elsa from Cask, ELPA Syncer, 2024/11/02
- [nongnu] elpa/mastodon ee25cb9b02 41/50: update point after widget. FIX #615, ELPA Syncer, 2024/11/02
- [nongnu] elpa/mastodon c09935b100 37/50: tl: remove stale args to insert status, inc. action-byline arg, ELPA Syncer, 2024/11/02
- [nongnu] elpa/mastodon b47390993b 46/50: Merge branch 'poll-var' into develop, ELPA Syncer, 2024/11/02