diff options
| author | marty hiatt <martianhiatus@riseup.net> | 2023-10-30 19:53:17 +0100 | 
|---|---|---|
| committer | marty hiatt <martianhiatus@riseup.net> | 2023-10-30 19:53:17 +0100 | 
| commit | 40e8123b84ce54100a818e6b19507d3a492614f6 (patch) | |
| tree | 118d1611d54917787fad8ddd36c54199be2dadf7 /lisp/mastodon-tl.el | |
| parent | 87a6bc9d7d0026ba88a958ed9d3a9d074374b164 (diff) | |
| parent | 1bfcb22043580d6bc4252300f55135aac8c50aea (diff) | |
Merge branch 'triage-response-data' into develop
Diffstat (limited to 'lisp/mastodon-tl.el')
| -rw-r--r-- | lisp/mastodon-tl.el | 60 | 
1 files changed, 34 insertions, 26 deletions
| diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 7859413..135c7f5 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -1229,7 +1229,7 @@ displayed when the duration is smaller than a minute)."             (arg `(("choices[]" . ,option-as-arg)))             (response (mastodon-http--post url arg)))        (mastodon-http--triage response -                             (lambda () +                             (lambda (_)                                 (message "You voted for option %s: %s!"                                          (car option) (cdr option))))))) @@ -1852,7 +1852,7 @@ If UNMUTE, unmute it."            (when (y-or-n-p (format "%s this thread? " (capitalize mute-str)))              (let ((response (mastodon-http--post url)))                (mastodon-http--triage response -                                     (lambda () +                                     (lambda (_)                                         (if unmute                                             (message "Thread unmuted!")                                           (message "Thread muted!"))))))))))) @@ -2086,27 +2086,35 @@ ARGS is an alist of any parameters to send with the request."    (let ((response (mastodon-http--post url args)))      (mastodon-http--triage       response -     (lambda () -       (cond ((string-equal notify "true") -              (message "Receiving notifications for user %s (@%s)!" -                       name user-handle)) -             ((string-equal notify "false") -              (message "Not receiving notifications for user %s (@%s)!" -                       name user-handle)) -             ((string-equal reblogs "true") -              (message "Receiving boosts by user %s (@%s)!" -                       name user-handle)) -             ((string-equal reblogs "false") -              (message "Not receiving boosts by user %s (@%s)!" -                       name user-handle)) -             ((or (string-equal action "mute") -                  (string-equal action "unmute")) -              (message "User %s (@%s) %sd!" name user-handle action)) -             ((assoc "languages[]" args #'equal) -              (message "User %s filtered by language(s): %s" name -                       (mapconcat #'cdr args " "))) -             ((eq notify nil) -              (message "User %s (@%s) %sed!" name user-handle action))))))) +     (lambda (response) +       (let ((json (with-current-buffer response +                     (mastodon-http--process-json)))) +         ;; TODO: when > if, with failure msg +         (cond ((string-equal notify "true") +                (when (equal 't (alist-get 'notifying json)) +                  (message "Receiving notifications for user %s (@%s)!" +                           name user-handle))) +               ((string-equal notify "false") +                (when (equal :json-false (alist-get 'notifying json)) +                  (message "Not receiving notifications for user %s (@%s)!" +                           name user-handle))) +               ((string-equal reblogs "true") +                (when (equal 't (alist-get 'showing_reblogs json)) +                  (message "Receiving boosts by user %s (@%s)!" +                           name user-handle))) +               ((string-equal reblogs "false") +                (when (equal :json-false (alist-get 'showing_reblogs json)) +                  (message "Not receiving boosts by user %s (@%s)!" +                           name user-handle))) +               ((or (string-equal action "mute") +                    (string-equal action "unmute")) +                (message "User %s (@%s) %sd!" name user-handle action)) +               ((assoc "languages[]" args #'equal) +                (message "User %s filtered by language(s): %s" name +                         (mapconcat #'cdr args " "))) +               ((and (eq notify nil) +                     (eq reblogs nil)) +                (message "User %s (@%s) %sed!" name user-handle action))))))))  ;; FOLLOW TAGS @@ -2135,7 +2143,7 @@ If TAG provided, follow it."           (url (mastodon-http--api (format "tags/%s/follow" tag)))           (response (mastodon-http--post url)))      (mastodon-http--triage response -                           (lambda () +                           (lambda (_)                               (message "tag #%s followed!" tag)))))  (defun mastodon-tl--followed-tags () @@ -2153,7 +2161,7 @@ If TAG is provided, unfollow it."           (url (mastodon-http--api (format "tags/%s/unfollow" tag)))           (response (mastodon-http--post url)))      (mastodon-http--triage response -                           (lambda () +                           (lambda (_)                               (message "tag #%s unfollowed!" tag)))))  (defun mastodon-tl--list-followed-tags (&optional prefix) @@ -2251,7 +2259,7 @@ report the account for spam."              (params (mastodon-tl--report-params account toot))              (response (mastodon-http--post url params)))         (mastodon-http--triage response -                              (lambda () +                              (lambda (_)                                  (message "User %s reported!" handle)))))))  (defvar crm-separator) | 
