aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-tl.el
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2022-01-11 18:17:30 +0100
committermousebot <mousebot@riseup.net>2022-01-11 18:17:30 +0100
commite11e75101bd816a437d51da164bd9b6ccfca44ec (patch)
treeee53b6846bcd016449a0d3b6697e7cc75fd80292 /lisp/mastodon-tl.el
parentf9f4ce55ecf93cd8eeb609a38d4679aed5c5bace (diff)
parentdd5f445ca7dcdb013c1cb31b61b8ae01444405cc (diff)
Merge branch 'fix-local-mentions-links-checking'
Diffstat (limited to 'lisp/mastodon-tl.el')
-rw-r--r--lisp/mastodon-tl.el26
1 files changed, 16 insertions, 10 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index b2b8026..0e3de0e 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -494,11 +494,8 @@ START and END are the boundaries of the link in the toot."
url toot-instance-url))
(url-instance (concat "https://"
(url-host (url-generic-parse-url url))))
- (maybe-userhandle (if (string= mastodon-instance-url url-instance)
- ; if handle is local, then no instance suffix:
- (buffer-substring-no-properties start end)
- (mastodon-tl--extract-userhandle-from-url
- url (buffer-substring-no-properties start end)))))
+ (maybe-userhandle (mastodon-tl--extract-userhandle-from-url
+ url (buffer-substring-no-properties start end))))
(cond (;; Hashtags:
maybe-hashtag
(setq mastodon-tab-stop-type 'hashtag
@@ -550,11 +547,16 @@ START and END are the boundaries of the link in the toot."
BUFFER-TEXT is the text covered by the link with URL, for a user profile
this should be of the form <at-sign><user id>, e.g. \"@Gargon\"."
- (let ((parsed-url (url-generic-parse-url url)))
+ (let* ((parsed-url (url-generic-parse-url url))
+ (local-p (string=
+ (url-host (url-generic-parse-url mastodon-instance-url))
+ (url-host parsed-url))))
(when (and (string= "@" (substring buffer-text 0 1))
(string= (downcase buffer-text)
(downcase (substring (url-filename parsed-url) 1))))
- (concat buffer-text "@" (url-host parsed-url)))))
+ (if local-p
+ buffer-text ; no instance suffic for local mention
+ (concat buffer-text "@" (url-host parsed-url))))))
(defun mastodon-tl--extract-hashtag-from-url (url instance-url)
"Return the hashtag that URL points to or nil if URL is not a tag link.
@@ -734,7 +736,7 @@ Runs `mastodon-tl--render-text' and fetches poll or media."
(mastodon-tl--get-poll toot))
(mastodon-tl--media toot))))
-(defun mastodon-tl--insert-status (toot body author-byline action-byline)
+(defun mastodon-tl--insert-status (toot body author-byline action-byline &optional id)
"Display the content and byline of timeline element TOOT.
BODY will form the section of the toot above the byline.
@@ -744,7 +746,10 @@ portion of the byline that takes one variable. By default it is
ACTION-BYLINE is also an optional function for adding an action,
such as boosting favouriting and following to the byline. It also
takes a single function. By default it is
-`mastodon-tl--byline-boosted'"
+`mastodon-tl--byline-boosted'.
+
+ID is that of the toot, which is attached as a property if it is
+a notification."
(let ((start-pos (point)))
(insert
(propertize
@@ -752,7 +757,8 @@ takes a single function. By default it is
body
" \n"
(mastodon-tl--byline toot author-byline action-byline))
- 'toot-id (alist-get 'id toot)
+ 'toot-id (or id ; for notifications
+ (alist-get 'id toot))
'base-toot-id (mastodon-tl--toot-id toot)
'toot-json toot)
"\n")