aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-profile.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/mastodon-profile.el')
-rw-r--r--lisp/mastodon-profile.el28
1 files changed, 21 insertions, 7 deletions
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el
index 975f7b7..69cd65d 100644
--- a/lisp/mastodon-profile.el
+++ b/lisp/mastodon-profile.el
@@ -70,6 +70,8 @@
(autoload 'mastodon-search--insert-users-propertized "mastodon-search")
(autoload 'mastodon-tl--get-endpoint "mastodon-tl.el")
(autoload 'mastodon-toot--get-max-toot-chars "mastodon-toot")
+(autoload 'mastodon-tl--add-account-to-list "mastodon-tl")
+
(defvar mastodon-instance-url)
(defvar mastodon-tl--buffer-spec)
(defvar mastodon-tl--update-point)
@@ -244,6 +246,15 @@ JSON is the data returned by the server."
(mastodon-search--insert-users-propertized json :note)))
;; (mastodon-profile--add-author-bylines json)))
+(defun mastodon-profile--add-account-to-list ()
+ "Add account of current profile buffer to a list."
+ (interactive)
+ (when mastodon-profile--account
+ (let* ((profile mastodon-profile--account)
+ (id (alist-get 'id profile))
+ (handle (alist-get 'acct profile)))
+ (mastodon-tl--add-account-to-list nil id handle))))
+
;;; ACCOUNT PREFERENCES
(defun mastodon-profile--get-json-value (val)
@@ -568,8 +579,7 @@ FIELDS means provide a fields vector fetched by other means."
(followsp (or (equal follows-you 't) (equal followed-by-you 't)))
(fields (mastodon-profile--fields-get account))
(pinned (mastodon-profile--get-statuses-pinned account))
- (joined-ts (ts-parse
- (mastodon-profile--account-field account 'created_at))))
+ (joined (mastodon-profile--account-field account 'created_at)))
(with-output-to-temp-buffer buffer
(switch-to-buffer buffer)
(mastodon-mode)
@@ -616,11 +626,7 @@ FIELDS means provide a fields vector fetched by other means."
"\n")
"")
(propertize
- (format "Joined %s"
- (format "%s" (concat (ts-month-name joined-ts)
- " "
- (number-to-string
- (ts-year joined-ts)))))
+ (mastodon-profile--format-joined-date-string joined)
'face 'success)
"\n\n")
'profile-json account)
@@ -657,6 +663,14 @@ FIELDS means provide a fields vector fetched by other means."
(funcall update-function json)))
(goto-char (point-min))))
+(defun mastodon-profile--format-joined-date-string (joined)
+ "Format a Joined timestamp."
+ (let ((joined-ts (ts-parse joined)))
+ (format "Joined %s" (concat (ts-month-name joined-ts)
+ " "
+ (number-to-string
+ (ts-year joined-ts))))))
+
(defun mastodon-profile--get-toot-author ()
"Open profile of author of toot under point.