branch: elpa/mastodon
commit 9d043ea3fbb8f2b8d162329b570a84f4790fc6f6
Author: marty hiatt <[email protected]>
Commit: marty hiatt <[email protected]>

    unfilter langs: POST raw params and it works!
---
 lisp/mastodon-http.el | 16 +++++++++++-----
 lisp/mastodon-tl.el   |  4 +++-
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/lisp/mastodon-http.el b/lisp/mastodon-http.el
index 5065ee567c..47210873c7 100644
--- a/lisp/mastodon-http.el
+++ b/lisp/mastodon-http.el
@@ -141,14 +141,20 @@ Used for API form data parameters that take an array."
                             &optional params headers unauthenticated-p json)
   "POST synchronously to URL, optionally with PARAMS and HEADERS.
 Authorization header is included by default unless
-UNAUTHENTICATED-P is non-nil. If JSON, encode PARAMS as JSON for
-the request data."
+UNAUTHENTICATED-P is non-nil.
+
+If JSON is :json, encode PARAMS as JSON for
+the request data. If it is :raw, just use the plain params."
   (mastodon-http--authorized-request "POST"
     (let* ((url-request-data
             (when params
-              (if json
-                  (json-encode params)
-                (mastodon-http--build-params-string params))))
+              (cond ((eq json :json)
+                     (json-encode
+                      params))
+                    ((eq json :raw)
+                     params)
+                    (t
+                     (mastodon-http--build-params-string params)))))
            (url-request-extra-headers
             (append url-request-extra-headers ; auth set in macro
                     (unless (assoc "Content-Type" headers) ; pleroma compat:
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el
index 7fd7f98239..3d33e867f9 100644
--- a/lisp/mastodon-tl.el
+++ b/lisp/mastodon-tl.el
@@ -2109,7 +2109,7 @@ desired language if they are not marked as such (or as 
anything)."
   (let ((langs "languages[]"))
     (mastodon-tl--do-if-item
      ;; we need ("languages[]") as a param, with no "="
-     (mastodon-tl--follow-user user-handle nil langs nil :json))))
+     (mastodon-tl--follow-user user-handle nil langs nil :raw))))
 
 (defun mastodon-tl--read-filter-langs (&optional langs)
   "Read language choices and return an alist array parameter.
@@ -2292,6 +2292,8 @@ ARGS is an alist of any parameters to send with the 
request."
                ((or (string-equal action "mute")
                     (string-equal action "unmute"))
                 (message "User %s (@%s) %sd!" name user-handle action))
+               ((equal args "languages[]")
+                (message "User %s language filters removed!" name))
                ((assoc "languages[]" args #'equal)
                 (message "User %s filtered by language(s): %s" name
                          (mapconcat #'cdr args " ")))

Reply via email to