From 2d905fe0b92745eff1c6ba1c24f614e951bf5e46 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 12 Sep 2022 17:41:25 +0200 Subject: store metadata fields in a normal alist --- lisp/mastodon-profile.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lisp/mastodon-profile.el') diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 012e357..38aceae 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -406,11 +406,11 @@ This endpoint only holds a few preferences. For others, see (defun mastodon-profile--fields-get (account) "Fetch the fields vector (aka profile metadata) from profile of ACCOUNT. -Returns a list of lists." +Returns an alist." (let ((fields (mastodon-profile--account-field account 'fields))) (when fields (mapcar (lambda (el) - (list (alist-get 'name el) + (cons (alist-get 'name el) (alist-get 'value el))) fields)))) @@ -424,7 +424,7 @@ Returns a list of lists." (concat (format "_ %s " (car field)) (make-string (- (+ 1 left-width) (length (car field))) ?_) - (format " :: %s" (cadr field))) + (format " :: %s" (cdr field))) field)) ; hack to make links tabstops fields ""))) -- cgit v1.2.3 From caa5fdc35c50839a12da60f883f94e55af3a1c8b Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Mon, 12 Sep 2022 21:40:22 +0200 Subject: format profile preference params to match toot-send ones --- lisp/mastodon-profile.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/mastodon-profile.el') diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index 38aceae..ff729f0 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -274,7 +274,7 @@ Both args are strings. SOURCE means that the preference is in the 'source' part of the account JSON." (let* ((url (mastodon-http--api "accounts/update_credentials")) (pref-formatted (if source (concat "source[" pref "]") pref)) - (response (mastodon-http--patch url `((,pref-formatted ,val))))) + (response (mastodon-http--patch url `((,pref-formatted . ,val))))) (mastodon-http--triage response (lambda () (mastodon-profile-fetch-server-account-settings) -- cgit v1.2.3 From 0798cf6822733929d571973d2189377ef0a9f849 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Wed, 21 Sep 2022 16:20:14 +0200 Subject: handle empty relationships vector in make-buffer-for can be empty when doing url-lookup on a mention --- lisp/mastodon-profile.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lisp/mastodon-profile.el') diff --git a/lisp/mastodon-profile.el b/lisp/mastodon-profile.el index ff729f0..054f6e5 100644 --- a/lisp/mastodon-profile.el +++ b/lisp/mastodon-profile.el @@ -461,10 +461,12 @@ Returns an alist." (mastodon-profile--account-field account 'statuses_count))) (relationships (mastodon-profile--relationships-get id)) - (followed-by-you (alist-get 'following - (aref relationships 0))) - (follows-you (alist-get 'followed_by - (aref relationships 0))) + (followed-by-you (when (not (seq-empty-p relationships)) + (alist-get 'following + (aref relationships 0)))) + (follows-you (when (not (seq-empty-p relationships)) + (alist-get 'followed_by + (aref relationships 0)))) (followsp (or (equal follows-you 't) (equal followed-by-you 't))) (fields (mastodon-profile--fields-get account)) (pinned (mastodon-profile--get-statuses-pinned account))) -- cgit v1.2.3