aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-05-08 19:59:03 +0200
committermarty hiatt <martianhiatus [a t] riseup [d o t] net>2023-05-08 19:59:03 +0200
commitf3298f6d51b78cd904f144d54f3b229a7bb70c6b (patch)
tree2b6efe8266a159a52ad6d3e4762e6560432840a2
parent6493d0dec1cc311ade347327c2b8f9656779abba (diff)
rename profile--add-author-bylines to profile--format-user
-rw-r--r--lisp/mastodon-profile.el12
-rw-r--r--lisp/mastodon-tl.el2
-rw-r--r--test/mastodon-profile-tests.el76
3 files changed, 44 insertions, 46 deletions
diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el
index 68d74df..bd59bac 100644
--- a/lisp/mastodon-profile.el
+++ b/lisp/mastodon-profile.el
@@ -163,7 +163,7 @@ NO-REBLOGS means do not display boosts in statuses."
(mastodon-profile--make-profile-buffer-for
mastodon-profile--account
"following"
- #'mastodon-profile--add-author-bylines
+ #'mastodon-profile--format-user
nil
:headers)
(error "Not in a mastodon profile")))
@@ -175,7 +175,7 @@ NO-REBLOGS means do not display boosts in statuses."
(mastodon-profile--make-profile-buffer-for
mastodon-profile--account
"followers"
- #'mastodon-profile--add-author-bylines
+ #'mastodon-profile--format-user
nil
:headers)
(error "Not in a mastodon profile")))
@@ -706,19 +706,17 @@ IMG-TYPE is the JSON key from the account data."
(message "Loading your profile...")
(mastodon-profile--show-user (mastodon-auth--get-account-name)))
-(defun mastodon-profile--add-author-bylines (tootv)
- "Convert TOOTV into a author-bylines and insert.
+(defun mastodon-profile--format-user (tootv)
+ "Convert TOOTV into author-bylines and insert.
Also insert their profile note.
Used to view a user's followers and those they're following."
- ;;FIXME change the name of this fun now that we've edited what it does!
(let ((inhibit-read-only t))
(unless (seq-empty-p tootv)
(mapc (lambda (toot)
(let ((start-pos (point)))
(insert "\n"
(propertize
- (mastodon-tl--byline-author `((account . ,toot))
- :avatar)
+ (mastodon-tl--byline-author `((account . ,toot)) :avatar)
'byline 't
'toot-id (alist-get 'id toot)
'base-toot-id (mastodon-tl--toot-id toot)
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index cfa872b..1cd5f86 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -457,7 +457,7 @@ With arg AVATAR, include the account's avatar image."
(concat
;; avatar insertion moved up to `mastodon-tl--byline' by default in order
;; to be outside of text prop 'byline t. arg avatar is used by
- ;; `mastodon-profile--add-author-bylines'
+ ;; `mastodon-profile--format-user'
(when (and avatar
mastodon-tl--show-avatars
mastodon-tl--display-media-p
diff --git a/test/mastodon-profile-tests.el b/test/mastodon-profile-tests.el
index 56cb852..1936b99 100644
--- a/test/mastodon-profile-tests.el
+++ b/test/mastodon-profile-tests.el
@@ -122,48 +122,48 @@ When formatting Gargon's state we want to see
- the url of the avatar (yet to be loaded)
- the info attached to the name"
(with-mock
- ;; Don't start any image loading:
- (mock (mastodon-media--inline-images * *) => nil)
- ;; Let's not do formatting as that makes it hard to not rely on
- ;; window width and reflowing the text.
- (mock (shr-render-region * *) => nil)
- (if (version< emacs-version "27.1")
- (mock (image-type-available-p 'imagemagick) => t)
- (mock (image-transforms-p) => t))
+ ;; Don't start any image loading:
+ (mock (mastodon-media--inline-images * *) => nil)
+ ;; Let's not do formatting as that makes it hard to not rely on
+ ;; window width and reflowing the text.
+ (mock (shr-render-region * *) => nil)
+ (if (version< emacs-version "27.1")
+ (mock (image-type-available-p 'imagemagick) => t)
+ (mock (image-transforms-p) => t))
- (with-temp-buffer
- (let ((mastodon-tl--show-avatars t)
- (mastodon-tl--display-media-p t))
- (mastodon-profile--add-author-bylines (list gargron-profile-json)))
+ (with-temp-buffer
+ (let ((mastodon-tl--show-avatars t)
+ (mastodon-tl--display-media-p t))
+ (mastodon-profile--format-user (list gargron-profile-json)))
- (should
- (equal
- (buffer-substring-no-properties (point-min) (point-max))
- "\n Eugen (@Gargron)\n<p>Developer of Mastodon and administrator of mastodon.social. I post service announcements, development updates, and personal stuff.</p>\n"))
+ (should
+ (equal
+ (buffer-substring-no-properties (point-min) (point-max))
+ "\n Eugen (@Gargron)\n<p>Developer of Mastodon and administrator of mastodon.social. I post service announcements, development updates, and personal stuff.</p>\n"))
- ;; Check the avatar at pos 2
- (should
- (equal
- (get-text-property 2 'media-url)
- "https://files.mastodon.social/accounts/avatars/000/000/001/original/d96d39a0abb45b92.jpg"))
- (should
- (equal
- (get-text-property 2 'media-state)
- 'needs-loading))
+ ;; Check the avatar at pos 2
+ (should
+ (equal
+ (get-text-property 2 'media-url)
+ "https://files.mastodon.social/accounts/avatars/000/000/001/original/d96d39a0abb45b92.jpg"))
+ (should
+ (equal
+ (get-text-property 2 'media-state)
+ 'needs-loading))
- ;; Check the byline state
- (should
- (equal
- (get-text-property 4 'byline)
- t))
- (should
- (equal
- (get-text-property 4 'toot-id)
- (alist-get 'id gargron-profile-json)))
- (should
- (equal
- (get-text-property 4 'toot-json)
- gargron-profile-json)))))
+ ;; Check the byline state
+ (should
+ (equal
+ (get-text-property 4 'byline)
+ t))
+ (should
+ (equal
+ (get-text-property 4 'toot-id)
+ (alist-get 'id gargron-profile-json)))
+ (should
+ (equal
+ (get-text-property 4 'toot-json)
+ gargron-profile-json)))))
(ert-deftest mastodon-profile--search-account-by-handle--removes-at ()
"Should ignore a leading at-sign in user handle.