aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-toot.el
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2022-03-29 21:34:23 +0200
committermousebot <mousebot@riseup.net>2022-03-29 21:34:23 +0200
commit1cc9cc621c9ab31419f965d5958ff24b1bc8f987 (patch)
treed04b4aa8805f6c688b6cf666fe41633ceb954dc0 /lisp/mastodon-toot.el
parent6d4528ca05d946892e13cbc4657d0c379445b13d (diff)
toot--reply: improve mentions in replies
- make sure we get ID from parent if its a fave/boost - avoid duplicates if user or booster already in mentions list
Diffstat (limited to 'lisp/mastodon-toot.el')
-rw-r--r--lisp/mastodon-toot.el26
1 files changed, 20 insertions, 6 deletions
diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el
index 52b061c..79f3d74 100644
--- a/lisp/mastodon-toot.el
+++ b/lisp/mastodon-toot.el
@@ -621,7 +621,8 @@ candidate ARG. IGNORED remains a mystery."
(interactive)
(let* ((toot (mastodon-tl--property 'toot-json))
(parent (mastodon-tl--property 'parent-toot)) ; for new notifs handling
- (id (mastodon-tl--as-string (mastodon-tl--field 'id toot)))
+ (id (mastodon-tl--as-string
+ (mastodon-tl--field 'id (or parent toot))))
(account (mastodon-tl--field 'account toot))
(user (alist-get 'acct account))
(mentions (mastodon-toot--mentions (or parent toot)))
@@ -634,14 +635,27 @@ candidate ARG. IGNORED remains a mystery."
(if (and
(not (equal user booster))
(not (string-match booster mentions)))
+ ;; different booster, user and mentions:
(concat (mastodon-toot--process-local user)
;; "@" booster " "
- (mastodon-toot--process-local booster) mentions)
+ (mastodon-toot--process-local booster)
+ mentions)
+ ;; booster is either user or in mentions:
+ (if (not string-match user mentions)
+ ;; user not already in mentions:
+ (concat (mastodon-toot--process-local user)
+ mentions)
+ ;; user already in mentions:
+ mentions))
+ ;; no booster:
+ (if (not (string-match user mentions))
+ ;; user not in mentions:
(concat (mastodon-toot--process-local user)
- mentions))
- (concat (mastodon-toot--process-local user)
- mentions)))
- id (or parent toot))))
+ mentions)
+ ;; user in mentions already:
+ mentions)))
+ id
+ (or parent toot))))
(defun mastodon-toot--toggle-warning ()
"Toggle `mastodon-toot--content-warning'."